I have this question; I'll sum it up in steps
- Make the program add 7 animals to a list via inputs (DONE)
- Make the program select 3 random animals from that list (DONE)
- If the animals selected are all the same, print 'Bingo!' ; if not, loop the input until the user presses 'X' or gets a 'Bingo!'.
I'm having trouble with the last step, and I've tried searching everywhere and tried many methods but the code isn't doing the right thing. Here's the code:
import random
bingoList=[]
generatedList=[]
def generateCards():
for i in range(0,3):
print(random.choice(bingoList))
generatedList.append(a)
for i in range(0,7):
a=input("Enter an animal: ")
if (a.isdigit()==False):
bingoList.append(a)
else:
printprint("You are not allowed to input numbers; program stopping...")
exit()
print("All the animals have been stored, let's start the game..")
generateCards()
Aucun commentaire:
Enregistrer un commentaire