Hi @vinbitstarter, welcome to the forum!
Where are you having trouble with syntax?
Hi @vinbitstarter , welcome to the forums! You need to add a line at the top of your program:
and change line 11 to
that’s not syntax, I guess OP misunderstood.
@vinbitstarter i think i’ve found the problem
The syntax error in the code is in the following line:
The dot (
randint is causing the syntax error. It should be removed. The correct line should be:
choice = randint(1, 5)
This will assign a random integer between 1 and 5 (inclusive) to the variable
@vinbitstarter I see that you’ve fixed it. Great! You can mark the post that has helped you the most as a solution to close the topic.
He hadn’t even imported the random module when he asked the question. If you would skip the
random.randint, he would have to a)
from random import randint or b)
from random import *
sorry i missed that out
@vinbitstarter Since you have solved this, please close the topic by marking the reply that helped you most as the solution.
This is bad practice and inefficient.
import random better? (just wondering)
Yes, but it wouldn’t work with OP’s code.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.