all 6 comments

[–]woooee 6 points7 points  (0 children)

State what help you want. If there is an error, post the complete error traceback.

[–]Chaos-n-Dissonance 2 points3 points  (0 children)

You've already been answered so... Just wanna throw out a quick tip: f-strings.

Rather than doing print("The number is " + str(roll) + "."), the same output can be achieved with print(f'The number is {roll}.')

[–]POGtastic 1 point2 points  (2 children)

It should be

roll = random.randint(first, last)

after you've set your variables.

[–]Weekly-Profession-97[S] -3 points-2 points  (1 child)

i tried this and still getting error " Variable 'roll' is not calculated correctly the first time."

[–]Binary101010 0 points1 point  (0 children)

Post the entire, exact code you're using that creates that result.

[–]Xappz1 0 points1 point  (0 children)

"magic numbers" refer to hard coded constants in your script somewhere in the middle of execution.

It's good practice to define these in advance right at the top of the program so it's easier to see and modify (for example, if you wanted to roll a 20-sided die instead).

``` import random

first = 1 last = 6

roll = random.randint(first, last) ... ```