Lab.24 Your task is to write several functions that printthe lyrics of one of the best songs of all time
Question:
Lab.24 Your task is to write several functions that printthe lyrics of one of the best songs of all time to standard output.Rock-n-roll songs typically follow a verse?chorus form, where theverse is unique, but the chorus is repeated verbatim. Instead ofwriting the chorus text over and over, we will use a function. Wewill define the main function stub for you, your task is to writethe body of the main function and the remaining 4 functions toimplement the following song structure:
verse 1
chorus
verse 2
chorus
verse 3
chorus
We defined the lyrics strings for you. Print a newline betweensections so it is easier to differentiate between verses and thechorus.
MY CODE:
verse1_lyrics = """Sitting on a cornflake, waiting for the vanto comeCorporation tee-shirt, stupid bloody TuesdayMan, you've been a naughty boy, you let your face growlong"""verse2_lyrics = """Mister City, policeman sittingPretty little policemen in a rowSee how they fly like Lucy in the Sky, see how they runI'm crying, I'm crying"""verse3_lyrics = """Sitting in an English garden waiting for thesunIf the sun don't come, you get a tanFrom standing in the English rain"""chorus_lyrics = """I am the egg man, they are the egg menI am the walrus, goo goo g'joob"""
def main(): verse1() chorus() verse2() chorus() verse3() chorus()# these functions should print to standard output# they should take no parameters, and instead use the stringsdefined at the top level scopedef main(): # call other functions here verse1() chorus() verse2() chorus() verse3() chorus() print()
# these functions should print to standard output# they should take no parameters, and instead use the stringsdefined at the top level scopedef verse1(): print(verse1_lyrics) print()def verse2(): print(verse2_lyrics) print()def verse3(): print(verse3_lyrics) print()def chorus(): print(chorus_lyrics)main()
What is the problem with my code and how I can change it to getthe expected output above?
Management Science The Art of Modeling with Spreadsheets
ISBN: 978-1118582695
4th edition
Authors: Stephen G. Powell, Kenneth R. Baker