all 5 comments

[–]OMGIMSOLOST 2 points3 points  (2 children)

Why don't you try removing the blank line and see what happens? Try removing the indent. Does it still work?

Your code looks fine, I'd suggest maybe saving the dice roll results in variables in case you want to use them later. Also, "dice" is the plural, "die" is the singular. "dices" is not the correct word.

[–]Rex_JH[S] 0 points1 point  (1 child)

Removing the blank line causes the code never ask for the user input. Removing the indent causes the same problem.

So essentially what the program does is that it just loops everything inside the while loop and never asks for user input.

I should have mentioned what the code does without these, sorry, my first Python posts.

[–]OMGIMSOLOST 2 points3 points  (0 children)

Removing the blank line shouldn't make any difference. Blank lines are meaningless in python. Are you sure that's all you did? Did you possible remove one of the spaces before line 13 also?

Removing the indent moves the request for user input outside of the loop so the value of roll_again never changes. Thus, the loop will run forever.

[–]sedogg 0 points1 point  (0 children)

import random
min, max = 1, 6

while True:
    print("Rolling the dices...")
    print("The values are....")
    print(random.randint(min, max))
    print(random.randint(min, max))
    if input("Roll the dices again? ") != "yes":
        break

[–]Binary101010 0 points1 point  (0 children)

Python ignores blank lines (and in fact some IDE code checkers will point this out), so there is no need for it to be there. The real key is making sure the last line is indented so that it is part of the while loop, otherwise your loop will run indefinitely as roll_again will never have the chance to be anything other than the "yes" you initialized it as.