What am I doing wrong ! :( | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What am I doing wrong ! :(

import random a = random.randint(1,150) b = random.randint(-150,150) answer = a + b print(a + b) if a + b >= 0: print (answer("is a positive number!") elif a + b <= 0: print (answer("is a negative number!") File "source_file.py", line 11 elif a + b <= 0: ^ SyntaxError: invalid syntax

31st Mar 2019, 2:09 AM
Joey Barber
Joey Barber - avatar
3 Answers
+ 11
31st Mar 2019, 2:54 AM
Arushi Singhania
Arushi Singhania - avatar
+ 2
You forgot a closing parenthesis ) before the elif There's also another missing parenthesis at the end of line 12 EDIT: I didn't see it initially, answer is not a function, which means you can't do answer(argument). Answer is a variable. Or am I missing something?
31st Mar 2019, 2:29 AM
Luis SepĂșlveda
Luis SepĂșlveda - avatar
0
Thank you! :) it worked
31st Mar 2019, 1:07 PM
Joey Barber
Joey Barber - avatar