Rock-paper-scissors program. What's wrong? An error appears in random.choice()

Asked 2 years ago, Updated 2 years ago, 31 views

I keep getting errors in the 4th line


import random
rsplist = ["Scissors", "Rock", "Paper"]
mine = input('Please give me one of scissors, rock, paper, etc.)>')
computer = random.choice(rsplist)
def qustion():
    if mine == computer:
        print('You're {}, the computer's {} It's a tie!"format(mine, computer))
        again()
    else:
        If mine == 'Scissors':
            If computer == 'Rock':
                print('You're {}, the computer's {} I lost... '.format(mine, computer))
                again()
            else:
                print('You're {}, the computer's {} I won! '.format(minine, computer))
                again()
        else:
            If mine == 'Rock':
                if computer == 'Bo':
                    print('You're {}, the computer's {} I lost... '.format(mine, computer))
                    again()
                else:
                    print('You're {}, the computer's {} I won! '.format(minine, computer))
                    again()
            else:
                If mine == 'Bo':
                    if computer == 'Scissors':
                        print('You're {}, the computer's {} I lost... '.format(mine, computer))
                        again()
                    else:
                        print('You're {}, the computer's {} I won! '.format(minine, computer))
                        again()
                else:
                    print('It's weird! Give me either rock, paper, or scissors.')
                    again()
def again():
    answer = input ('Do you want to do it again? (Yes/No')
    If answer == 'Yes':
        qustion()
    else:
        if answer == 'No':
            print ('I'm sorry')
        else:
            print('Yes/No' please... Let me ask you again.')
            again()
qustion()

python python3

2022-09-22 16:50

1 Answers

The fourth line is mine = input(') Please give one of scissors, rock, or paper>') If you mean , I think you turned the script back to Python2 that you should have turned to Python3. When running a Python script

Run with python3 <ScriptName> or

Or change input to raw_input in the code.


2022-09-22 16:50

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.