1
from random import *

print randint(1, 100)
print (x)

If I try to run this code I receive an error stating, "randint" is an invalid syntax.

Hollings
  • 534
  • 5
  • 14
Veritox
  • 11
  • 2
  • 2
    You seem to be using mixed Python 2/Python 3 `print` statements. That's likely the source of the syntax error. Please edit your question to use code blocks and include the full traceback of the error you get. – Josh Karpel Sep 08 '17 at 22:05

2 Answers2

2

Because you are probably using python 3, you have to enclose what you want to print in brackets:

from random import *
print(randint(1, 100))
Bob
  • 1,004
  • 9
  • 12
0

Try following code.It's working for me.

from random import *
print(randint(1, 100))
amol
  • 1
  • 1