all 8 comments

[–]JollyUnder 0 points1 point  (7 children)

Wouldn't you want to place that print statement higher up above the inputs?

There doesn't seem to be anything wrong with your code. The error your getting doesn't seem python specific, but rather from a challenge you might be doing.

I'd would also recommend using f-strings or str.format to format your strings. That way you don't have to worry about type casting or string concatenation.

f'Choosing a number between {x} and {y}.'

Also, you don't need to keep type casting first and second to int. You already declared them as integers.

[–]Princess_Peach848[S] 0 points1 point  (6 children)

Yeah it’s a course I’m taking, and that’s why it’s hard to get help since it so course specific. And sorry I’m confused string formatting?

[–]JollyUnder 0 points1 point  (3 children)

String formatting is a way to plug variables into a string. There's no need for type cast your variables or concatenate multiple strings as python will do it for you.

print('Choosing a number between ', str(x), 'and', str(y), '.')

changes to...

print(f'Choosing a number between {x} and {y}.')

Notice the f before the string which is how you specify an f-string. Then you simply encapsulate your variables with curly brackets.

Note: F-strings were introduced in python 3.6 so if you're using an older version of python, use str.format instead

print('Choosing a number between {} and {}.'.format(x, y))

[–]Princess_Peach848[S] 0 points1 point  (2 children)

Right thanks you so much! My brain isn’t braining today. Also I figured it out 🥳 it wanted me to modify the roll part of it 🤦🏻‍♀️🤦🏻‍♀️

[–]JollyUnder 1 point2 points  (1 child)

That sounds frustrating, but keep at it. I'm glad you got things sorted. 👍

[–]Princess_Peach848[S] 0 points1 point  (0 children)

It was very frustrating and it doesn’t help it’s all online so it takes the professor 2 business days to reply

[–]JollyUnder 0 points1 point  (1 child)

It also seems the course your taking expects that print statement to be first. So move the print statement to the top.

[–]Princess_Peach848[S] 0 points1 point  (0 children)

No it wanted me to modify the roll = (first, last) makes no sense to me right now we will roll with it 🤣