def format_heading(level, text):
 underlining = (['=', '-', '~'][(level - 1)] * len(text))
 return ('%s\n%s\n\n' % (text, underlining))

def format_heading ( level , text ) : underlining = ( [ '=' , '-' , '~' ] [ ( level - 1 ) ] * len ( text ) ) return ( '%s\n%s\n\n' % ( text , underlining ) )
create a heading of <level> [1 .