Simple Boolean Return

3024 views python
2

Aim of the code: If N is greater than or equal to 100, output a boolean True, otherwise False.

# Get N from the command line
import sys
N = int(sys.argv[1])

N >= 100:
  print('True')
else:
  print('False')

I keep getting syntax error when I run the above code. How do I fix this?

answered question

keep getting syntax error then post it. Also, True is a string, not a boolean

You're missing two ifs.

1 Answer

4

You're missing an if in what should be if N >= 100:.

posted this

Have an answer?

JD

Please login first before posting an answer.