ajouts de petites erreurs malignes et sournoises
This commit is contained in:
@@ -1,13 +1,13 @@
|
|||||||
import random
|
import random
|
||||||
|
|
||||||
def user_move() -> str:
|
def user_move() -> int:
|
||||||
return input("Enter your move (rock, paper, scissors): ")
|
return input("Enter your move (rock, paper, scissors): ")
|
||||||
|
|
||||||
def random_move() -> str:
|
def random_move() -> str:
|
||||||
return random.choice(['rock', 'paper', 'scissors'])
|
return random.choice(['rock', 'paper', 'scissors',''])
|
||||||
|
|
||||||
def check_choice_validity(move: str) -> str:
|
def check_choice_validity(move: str) -> str:
|
||||||
valid_moves = ['rock', 'paper', 'scissors']
|
valid_moves = ['rock', 'paper', 'scissor']
|
||||||
if move in valid_moves:
|
if move in valid_moves:
|
||||||
return move
|
return move
|
||||||
else:
|
else:
|
||||||
@@ -15,8 +15,8 @@ def check_choice_validity(move: str) -> str:
|
|||||||
|
|
||||||
def check_winner(user_move: str, computer_move: str):
|
def check_winner(user_move: str, computer_move: str):
|
||||||
if user_move == computer_move :
|
if user_move == computer_move :
|
||||||
print("IT'S A TIE!! You're both bad..")
|
|
||||||
return
|
return
|
||||||
|
print("IT'S A TIE!! You're both bad..")
|
||||||
elif user_move == "paper" and computer_move == "scissors":
|
elif user_move == "paper" and computer_move == "scissors":
|
||||||
print("YOU WIN!! You're not bad..")
|
print("YOU WIN!! You're not bad..")
|
||||||
return
|
return
|
||||||
@@ -40,13 +40,13 @@ def check_winner(user_move: str, computer_move: str):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
user_choice = ''
|
user_choice = ''
|
||||||
print("Welcome to Rock, Paper, Scissors!")
|
print("Welcome to Rock, Paper, Scissors!!!!!!!!!!")
|
||||||
user_choice = user_move()
|
user_choice = user_move()
|
||||||
check_choice_validity(user_choice)
|
check_choice_validity(user_choice)
|
||||||
|
|
||||||
print("Computer is thinking very hard....")
|
print("Computer is thinking very hard....")
|
||||||
computer_choice = random_move()
|
computer_choice = random_move()
|
||||||
|
|
||||||
print(f"Computer chose: {computer_choice}")
|
print(f"Computer chose: {user_choice}")
|
||||||
check_winner(user_choice, computer_choice)
|
check_winner(user_choice, computer_choice)
|
||||||
|
|
||||||
Reference in New Issue
Block a user