Uploaded by AIDEN RANA

Progam Create Task Code

advertisement
import random
#Guessing rap song game
# Song titles
songs = ['Lose Yourself', 'Straight Outta Compton', 'It was a good
Day', 'Space Cadet', 'Anaconda',
'Gods plan', 'The Box', 'In da Club', 'Drip too hard', 'Lucid Dreams',
'Empire state of Mind',
'A lot', 'Pop out', 'Stronger', 'No role modelz', 'Umbrella',
'Humble.', 'Mask off',
'The World Is Yours', 'Dear Mama']
# Correct artists
artists = ['Eminem', 'N.W.A.', 'Ice Cube', 'Metro Boomin', 'Nicki
Minaj', 'Drake', 'Roddy Rich',
'50 Cent', 'Lil Baby', 'Juice Wrld', 'Jay-Z', '21 Savage', 'Polo G',
'Kanye West', 'J.cole',
'Rihanna', 'Kendrick Lamar', 'Future', 'Nas', 'Tupac']
# creation of random song as well as starting text
songNum = random.randint(0,19)
print('You must guess the name of the artist of a given song,')
print('you have 3 guesses to get it correct, to begin type "Guess"')
start = 'x'
guesses = 0
#different end game conditions
def endGame(condition):
print('You ' + condition)
#checks guesses against answers
def GuessArtist():
G = input()
for artist in artists:
if (G == artist):
GN = artists.index(G)
if (GN == songNum):
endGame('win')
elif(guesses >= 3 and GN != songNum):
endGame('lose')
break
while(start != "Guess"):
start = input()
if(start == "Guess"):
print("Song Name: " + songs[songNum])
while (guesses <= 2):
guesses += 1
GuessArtist()
Download