Problem with input() function in python 3.10.0
When i try to run the entire script shown below the input() function doesn’t prompt. Instead i get a list of different errors. I want to know why i can’t run the entire script without getting errors? If i run the input() function alone, enter a integer value, and run the rest of the script, the result is fine. But i want to run the entire thing at once.
Script
num = int(input('Enter value: '))
if num < 0:
print('The integer is negative')
elif num == 0:
print('The integer is zero')
else:
print('The integer is positive')
Terminal
num = int(input('Enter value: '))
Enter value: if num < 0:
Traceback (most recent call last):
File “”, line 1, in
ValueError: invalid literal for int() with base 10: ‘if num < 0:’
print(‘The integer is negative’)
File “”, line 1
print(‘The integer is negative’)
IndentationError: unexpected indent
elif num == 0:
File “”, line 1
elif num == 0:
^^^^
SyntaxError: invalid syntax
print(‘The integer is zero’)
File “”, line 1
print(‘The integer is zero’)
IndentationError: unexpected indent
else:
File “”, line 1
else:
^^^^
SyntaxError: invalid syntax
print(‘The integer is positive’)
File “”, line 1
print(‘The integer is positive’)
IndentationError: unexpected indent