Python Forum
Rock, Paper, Scissors.. Help..hidden bug
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rock, Paper, Scissors.. Help..hidden bug
#4
I've changed line 48 with this
elif y not in options:
        print("Enter any of the options ")
that works great so far actually. what do you think about my counter i wanted to make a counter of 5 if the computer or player gets 5 points first it prints out one of the last print statements at line 53

(Mar-18-2020, 06:43 PM)ndc85430 Wrote: On line 48, you're checking whether y is equal to the function str. Clearly, that will never be True. You don't want to check whether y is of type str, either (with isinstance) because on line 10, you know it's already a string. Incidentally, you don't need the call to str on line 10, since input already returns a string. If you want to check whether a string contains only alphabetical characters, then have a look at the documentation to see if you can find an appropriate method.

Also, variable names like x and y are pretty meaningless - use names that tell you what the variable is for. That helps everyone (you included) to read and therefore understand the code.

I've changed line 48 with this

elif y not in options:
        print("Enter any of the options ")
that works great so far actually. what do you think about my counter i wanted to make a counter of 5 if the computer or player gets 5 points first it prints out one of the last print statements at line 53
Reply


Messages In This Thread
RE: Rock, Paper, Scissors.. Help..hidden bug - by xxunknownxx - Mar-18-2020, 06:59 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Rock Paper Scissors Project in Python ankitdixit 8 4,966 Feb-23-2024, 03:14 PM
Last Post: DPaul
  Copy only hidden files and folders with rsync Cannondale 2 1,077 Mar-04-2023, 02:48 PM
Last Post: Cannondale
  Trying to create a visual rock paper scissors game urmom33 1 1,076 Dec-03-2022, 09:12 PM
Last Post: deanhystad
  Can ZipFile be used to extract hidden files? AiedailEclipsed 0 1,676 Mar-22-2022, 05:21 PM
Last Post: AiedailEclipsed
  Rock paper scissors in python with "algorithm" Agat0 23 6,281 Mar-01-2022, 03:20 PM
Last Post: Agat0
  Problem restricting user input in my rock paper scissors game ashergreen 6 4,696 Mar-25-2021, 03:54 AM
Last Post: deanhystad
  Odd behavior with Rock Paper Scissor game DustinKlent 2 1,998 Aug-27-2020, 03:55 PM
Last Post: DustinKlent
  Run hidden exe samuelbachorik 0 2,758 Aug-02-2020, 03:10 PM
Last Post: samuelbachorik
  Trying to implement Best of 3 logic in rock paper scissors game ShAhCh 5 3,429 May-11-2020, 04:31 PM
Last Post: ShAhCh
  Rock Paper Scissors with dictionaries ewgreht 2 3,951 May-01-2020, 03:19 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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