Python error "SyntaxError: invalid syntax"

0 votes

I have a very simple python snippet:

from random import *

ip1 = input('Enter the N1 :')
ip2 = input('Enter the N2 :')

r = randint({0},{1}.format(ip1,ip2))

print r

But I get the following error:

File "index.py", line 6
    r = randint({0},{1}.format(i1,i2))
                  ^
SyntaxError: invalid syntax
Jul 5 in Python by Ruth
152 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Python

0 votes
1 answer

'Syntax Error: invalid syntax' for no apparent reason

You're missing a close paren in this ...READ MORE

answered Aug 13, 2018 in Python by Priyaj
• 56,520 points
81 views
0 votes
1 answer

How to fix this? ValueError: invalid literal for int() with base 10 error in Python

The following are totally acceptable in python: passing ...READ MORE

answered Nov 16, 2018 in Python by Nymeria
• 3,520 points
11,748 views
0 votes
0 answers

What exactly is invalid syntax error?

Isnt it same as a nameerror, there ...READ MORE

Jun 12 in Python by Waseem
• 4,480 points
34 views
0 votes
1 answer
0 votes
0 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 232 views
+4 votes
6 answers