mardi 29 juin 2021

What's is the wrong in the program

import random
random_Number = random.randrange(1, 4)

support = input('Write help to support ')

if support == "help":
    print("this is Rock, Paper, Scissors game ")
    play_Game = input('-enter 1 to Rock\n-enter 2 Paper\n-enter 3 to Scissors \n')
    if random_Number == 1 and play_Game == 1 :
        print('The game is draw\n Try Again!')

    elif random_Number == 2 and play_Game == 1:
        print('You lose!\n Hard luck')

    elif random_Number == 3 and play_Game == 1:
        print('You won!\n Good luck')

    elif random_Number == 1 and play_Game == 2:
        print('You won!\n Good luck')

    elif random_Number == 2 and play_Game == 2:
        print('The game is draw\n Try Again!')

    elif random_Number == 2 and play_Game == 2:
        print('The game is draw\n Try Again!')

    elif random_Number == 3 and play_Game == 2:
        print('You lose!\n Hard luck')

    elif random_Number == 1 and play_Game == 3:
        print('You lose!\n Hard luck')

    elif random_Number == 2 and play_Game == 3:
        print('You won!\n Good luck')

    elif  random_Number == 3 and play_Game == 3:
        print('The game is draw\n Try Again!')
    else:
        print('please, enter a correct number ')


else:
   print("write the true keyword")

Comment: When I type 1, 2, or 3 it tells me to enter the correct number I think the wrong is in if statements. I have learned python and this is my first project. please, tell me is it a clean code?

Aucun commentaire:

Enregistrer un commentaire