با سلام در هنگام اجرا زمانی که یک ورودی اشتباه میدم میگه دوباره تلاش کن و مشکلی نداره اما وقتی هر کدام از گزینههای r , p, s رو میزنم میگه تایپ لیست ان هشیبل است
import random
from config import GAME_CHOICES, RULES, scoreboard
def get_user_choice():
user_input = input("enter your choice please(r, p, s): ")
if user_input not in GAME_CHOICES:
print("Oops!!, wrong choice, try again please...")
return get_user_choice()
return user_input
def get_system_choice():
return random.choices(GAME_CHOICES)
def find_winner(user, system):
match = {user, system}
if len(match) == 1:
return None
return RULES[tuple(sorted(match))]
def play():
result = {"user": 0, "system": 0}
while result['user'] < 3 and result['system'] < 3:
user_choice = get_user_choice()
system_choice = get_system_choice()
winner = find_winner(user_choice, system_choice)
if winner == user_choice:
msg = "you wine"
result['user'] += 1
if winner == system_choice:
msg = "tou lose"
result['system'] += 1
else:
msg = "draw"
print(f"user: {user_choice}\tsystem: {system_choice}\t result: {msg}")
if __name__ == '__main__':
play()
به این قسمت گیر میده match = {user, system}