5.1 - Happy
Create a program that prints the first verse, the chorus, the second verse, and the chorus of Happy.
The verses and chorus should be stored as procedures.
Look at the example run for the lyrics to use.
It might seem crazy what I am 'bout to say Sunshine, she's here you can take a break I'ma hot air balloon that could go to space, huh With the air, like I don't care, baby, by the way, huh Clap along if you feel like a room without a roof (Because I'm happy) Clap along if you feel like happiness is the truth (Because I'm happy) Clap along if you know what happiness is to you (Because I'm happy) Clap along if you feel like that's what you wanna do Here come bad news, talking this and that Well, give me all you got and don't hold back Well, I should probably warn you, I'll be just fine No offense to you, don't waste your time, here's why Clap along if you feel like a room without a roof (Because I'm happy) Clap along if you feel like happiness is the truth (Because I'm happy) Clap along if you know what happiness is to you (Because I'm happy) Clap along if you feel like that's what you wanna do
PROCEDURE chorus()
DISPLAY chorus lyrics
END PROCEDURE
PROCEDURE verse1()
DISPLAY verse 1 lyrics
END PROCEDURE
PROCEDURE verse2()
DISPLAY verse 2 lyrics
END PROCEDURE
# Main program
CALL verse1()
CALL chorus()
CALL verse2()
CALL chorus()
# Main verse1() chorus() verse2() chorus()
def chorus():
print("Clap along if you feel like a room without a roof")
print("Because I'm happy")
print("Clap along if you feel like happiness is the truth")
print("Because I'm happy")
print("Clap along if you know what happiness is to you")
print("Because I'm happy")
print("Clap along if you feel like that's what you wanna do")
print()
def verse1():
print("It might seem crazy what I am 'bout to say")
print("Sunshine, she's here you can take a break")
print("I'ma hot air balloon that could go to space, huh")
print("With the air, like I don't care, baby, by the way, huh")
def verse2():
print("Here come bad news, talking this and that")
print("Well, give me all you got and don't hold back")
print("Well, I should probably warn you, I'll be just fine")
print("No offense to you, don't waste your time, here's why")
# Main
verse1()
chorus()
verse2()
chorus()
def chorus(): # procedure for the chorus
print("Clap along if you feel like a room without a roof")
print("Because I'm happy")
print("Clap along if you feel like happiness is the truth")
print("Because I'm happy")
print("Clap along if you know what happiness is to you")
print("Because I'm happy")
print("Clap along if you feel like that's what you wanna do")
print()
def verse1(): # procedure for verse 1
print("It might seem crazy what I am 'bout to say")
print("Sunshine, she's here you can take a break")
print("I'ma hot air balloon that could go to space, huh")
print("With the air, like I don't care, baby, by the way, huh")
def verse2(): # procedure for verse 2
print("Here come bad news, talking this and that")
print("Well, give me all you got and don't hold back")
print("Well, I should probably warn you, I'll be just fine")
print("No offense to you, don't waste your time, here's why")
# Main program (only calls to procedures)
verse1() # call verse 1
chorus() # call chorus after verse 1
verse2() # call verse 2
chorus() # call chorus after verse 2
Extension
Update the program to display the rest of the song. Create new procedures as necessary.
verse1() chorus() verse2() chorus() ?????() ...