在为变量赋值时,它说语法错误 python
While assigning value to a variable it says syntax error in python
每当我尝试 运行 这个变量 y 显示语法错误
print('Check if your no. is odd or even!')
x=int(input('Insert no.')
y=x%2
if a==0:
print('Your no. is even')
else:
print('Your no. is odd')
定义 x 时需要右括号。这是更正后的代码:
x=int(input('Insert no.'))
您可能在以下位置丢失了“)”:
x=int(input('Insert no.')) <- close bracket
每当我尝试 运行 这个变量 y 显示语法错误
print('Check if your no. is odd or even!')
x=int(input('Insert no.')
y=x%2
if a==0:
print('Your no. is even')
else:
print('Your no. is odd')
定义 x 时需要右括号。这是更正后的代码:
x=int(input('Insert no.'))
您可能在以下位置丢失了“)”:
x=int(input('Insert no.')) <- close bracket