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 Respostas
+ 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