I printed a code, but after any of input you write, it says who win and 'Invalid Input', i don't get what am I doing wrong? Can someone help me?
import random
while True:
user_move = str(input())
user_move = user_move.lower()
choices= ['rock', 'paper', 'scissors']
computer_choice = random.choice(choices)
if user_move in choices:
if user_move == computer_choice:
print(f'There is a draw ({user_move})')
if user_move == 'rock':
if computer_choice == 'paper':
print(f'Sorry, but the computer chose {computer_choice}' )
elif computer_choice == 'scissors':
print(f'Well done. The computer chose {computer_choice} and failed')
if user_move == 'paper':
if computer_choice == 'scissors':
print(f'Sorry, but the computer chose {computer_choice}')
elif computer_choice == 'rock':
print(f'Well done. The computer chose {computer_choice} and failed')
if user_move == 'scissors':
if computer_choice == 'rock':
print(f'Sorry, but the computer chose {computer_choice}')
elif computer_choice == 'paper':
print(f'Well done. The computer chose {computer_choice} and failed')
if user_move == '!exit':
print('Bye!')
else:
print('Invalid input') ```
Aucun commentaire:
Enregistrer un commentaire