فارسی
باز کردن در Telegram

رشتهٔ گفتگو دوستان یه کد میخوام بنویسم برای بازی سنگ کاغذ قیچی تو پایتون اجرا کنم

9 پیام · –
A
دوستان یه کد میخوام بنویسم برای بازی سنگ کاغذ قیچی تو پایتون اجرا کنم میشه یه راهنمایی کنید؟
  1. .
    عکس
    برای نمایش کلیک کنید
    این کدیه که من قبلا نوشتم
  2. .
    عکس
    برای نمایش کلیک کنید
  3. <
    import random def get_user_choice():     user_input = input("Enter your choice (rock, paper, scissors): ")     while user_input not in ["rock", "paper", "scissors"]:         print("Please enter a valid option.")         user_input = input("Enter your choice (rock, paper, scissors): ")     return user_input def get_computer_choice():     choices = ["rock", "paper", "scissors"]     return random.choice(choices) def determine_winner(user_choice, computer_choice):     if user_choice == computer_choice:         return "It's a tie!"     elif (user_choice == "rock" and computer_choice == "scissors") or          (user_choice == "paper" and computer_choice == "rock") or          (user_choice == "scissors" and computer_choice == "paper"):         return "You win!"     else:         return "Computer wins!" def play_game():     print("Welcome to Rock, Paper, Scissors!")     user_choice = get_user_choice()     computer_choice = get_computer_choice()         print(f"Your choice: {user_choice}")     print(f"Computer's choice: {computer_choice}")         result = determine_winner(user_choice, computer_choice)     print(result) if __name__ == "__main__":     play_game()
گگروه حل اشکال صفر تا صد پایتونگروه حل اشکال صفر تا صد پایتون@problem_python · گروه · فناوری
2 380عضو28 590پیام در ایندکس
فید انجمن باز کردن در Telegram

فید عمومی باز از ایندکس جست‌وجو ChatCrawler — «Google برای Telegram عمومی»؛ با خزش انجمن به‌روز می‌شود. زمان‌ها به UTC است.

فقط محتوای عمومی، API رسمی Telegram. دربارهٔ ما · پرسش‌ها · محدودیت‌های ایندکس · حذف یک صفحه · کاتالوگ · جست‌وجو · روش محاسبهٔ ما