jeudi 27 décembre 2018

Error: TypeError: 'str' object cannot be interpreted as an integer while trying to pick a random winner (Python)

I'm kind of new to programming and I've been trying to mess with Python a bit but while I was trying to make a random name picker that picks a random name from a list I always end up getting the same error .I also try to remove the winner that the code chose and add a new name to the 'winners' list but it doesn't seem to work. This is the short code I have right now.

winners = ["Wane", "Trevor", "Franklin", "Martoz"]
winner = random.choice(winners)
winners.pop(winner)
winners.append("Michael")
print(winners)




Aucun commentaire:

Enregistrer un commentaire