Oct-11-2017, 10:55 AM
(This post was last modified: Oct-11-2017, 11:12 AM by gruntfutuk.)
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.
I cannot see any loops in your code.
Loops will use constructs such as:
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.)
(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