Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rock Paper Scissors
#5
Please write [python] before you paste your code into a post, and then write [/python] after your code is pasted.

(If you prefer, you can paste your code, select it, and then click the python icon in the formatting bar of the post entry dialogue box to enter the start and finish tags for you.)

This will preserve the layout of your code as written in your text editor / IDE, with all the indentations that are critical to python displayed normally.

Without this, the indentations are messed up when you paste code, and we are not as easily able to see where problems might be.

(Oct-06-2017, 02:08 AM)Warmlawpk441 Wrote: I seem to have an issue with getting this program to enter the loops correctly and the computer to generate a random number to compare against the user's input. ...

I cannot see any loops in your code.

Loops will use constructs such as: for play in numberofplays:, where numberofplays is an integer variable holding the number of rounds, or while playing:, where playing is a boolean variable used to indicate whether the game should continue or not.

Here's an example, throwing two dice (python 3):

(Note. In this example, the while statement evaluates an expression to get a True or False outcome to decide whether or not the indented code below the while statement should be executed or not.)

import random
min = 1
max = 6

roll_again = "yes"

while roll_again == "yes" or roll_again == "y":
    print("Rolling the dices...")
    print("The values are....")
    print(random.randint(min, max))
    print(random.randint(min, max))

    roll_again = input("Roll the dices again?")
I am trying to help you, really, even if it doesn't always seem that way
Reply


Messages In This Thread
Rock Paper Scissors - by Warmlawpk441 - Oct-06-2017, 02:08 AM
RE: Rock Paper Scissors - by ichabod801 - Oct-06-2017, 02:15 AM
RE: Rock Paper Scissors - by Warmlawpk441 - Oct-07-2017, 06:30 PM
RE: Rock Paper Scissors - by ichabod801 - Oct-07-2017, 06:33 PM
RE: Rock Paper Scissors - by gruntfutuk - Oct-11-2017, 10:55 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  I attempted to make a rock paper scissors bot for homework Intellectual11 3 2,960 Jun-24-2021, 08:00 PM
Last Post: deanhystad
Question Rock, paper, scissors spelling error banidjamali 6 3,302 Jan-19-2021, 02:51 PM
Last Post: banidjamali
  Rock, Paper, Scissors Game kramon19 2 5,405 Jan-10-2020, 08:18 AM
Last Post: perfringo
  I need help with a python Rock Paper Scissors game urgently. Riff_Raff 3 5,918 Dec-05-2018, 09:13 PM
Last Post: nilamo
  Rock, Paper, Scissors Advanced that saves, loads, and keeps statistics EvanCahill 0 5,243 Jul-21-2018, 07:32 PM
Last Post: EvanCahill
  Rock paper scissors game samiraheen 3 6,435 Oct-03-2017, 07:07 PM
Last Post: buran
  The Python Book altered rock paper scissors Python_Noob 0 2,946 Sep-18-2017, 06:13 AM
Last Post: Python_Noob
  HELP---problems with rock paper scissors games kalt91 2 4,176 Sep-15-2017, 04:51 PM
Last Post: micseydel
  Rock, Paper, Scissors game help.. hentera 3 5,116 May-19-2017, 10:56 PM
Last Post: ichabod801
  Rock Paper Scissors game codeobri 3 13,482 Apr-28-2017, 01:02 AM
Last Post: codeobri

Forum Jump:

User Panel Messages

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