저는 며칠 전에 python을 시작했습니다. 'if'와 'elif'를 사용하여 기본 프로그램을 만들었습니다. ... elif를 사용하면python에서 elif 오류가 발생했습니다. 3
내가 이것을 실행할 때syntax error:invalid syntax
print('welcome to my calculator')
num1 = int(input('enter the first number:'))
num2 = int(input('enter the second number:'))
print('select options')
functions = ['Add','Sub','Mul','Div']
print (functions)
options = input("enter the desired option:")
if options == 'Add':
print(num1+num2)
print('num1+num2=', num1+num2)
elif options == 'Sub':
print(num1-num2)
print('num1-num2=', (num1-num2))
, 나는 다음과 같은 오류
있어elif options == 'Sub':
^
SyntaxError: invalid syntax
Process finished with exit code 1
누구도 날이 오류를 해결하는 데 도움이 수 있습니까?
' print ('num1 + num2 =', num1 + num2)'행은 위의 행과 동일한 방식으로 들여 쓰기되어야합니다. –
한 행을'spaces'로 들여 쓰고 다른 행을'tab'으로 들여 쓰기했을 수 있습니다. '탭'또는 두 공간 모두로 변경하십시오 –
고맙습니다. 빠른 응답을 위해 많이 ... .... 완료되었습니다. :) – user8960966