Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
rock,paper,scissors
#11
well in my lesson the AI only does 1 input thats wrong: Spaceshuttle
that i handled with this code:


elif player == ("Spaceshuttle"):

           print("Incorrect selection.")
i couldnt figure out how to do it for all wrong inputs xD
Reply
#12
Use an 'else' clause:

player = "some-response"
if "rock" == player:
    # do things
elif "paper" == player:
    # do things
elif "scissors" == player:
    # do things
else:
    print("not a valid response")
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  I attempted to make a rock paper scissors bot for homework Intellectual11 3 2,919 Jun-24-2021, 08:00 PM
Last Post: deanhystad
Question Rock, paper, scissors spelling error banidjamali 6 3,214 Jan-19-2021, 02:51 PM
Last Post: banidjamali
  Rock, Paper, Scissors Game kramon19 2 5,348 Jan-10-2020, 08:18 AM
Last Post: perfringo
  I need help with a python Rock Paper Scissors game urgently. Riff_Raff 3 5,850 Dec-05-2018, 09:13 PM
Last Post: nilamo
  Rock, Paper, Scissors Advanced that saves, loads, and keeps statistics EvanCahill 0 5,209 Jul-21-2018, 07:32 PM
Last Post: EvanCahill
  Rock Paper Scissors Warmlawpk441 4 5,039 Oct-11-2017, 10:55 AM
Last Post: gruntfutuk
  Rock paper scissors game samiraheen 3 6,366 Oct-03-2017, 07:07 PM
Last Post: buran
  The Python Book altered rock paper scissors Python_Noob 0 2,917 Sep-18-2017, 06:13 AM
Last Post: Python_Noob
  HELP---problems with rock paper scissors games kalt91 2 4,127 Sep-15-2017, 04:51 PM
Last Post: micseydel
  Rock, Paper, Scissors game help.. hentera 3 5,056 May-19-2017, 10:56 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020