방금 창을 닫으려면 실행하자 마자 첫 번째 Python 프로그램을 작성했습니다. 나는 행운이없는 다른 스레드에서 발견 된 몇 가지 픽스를 시도했다. 다음은 코드입니다. 구문에서 오류가 발생합니다. 도와 주셔서 감사합니다!실행했을 때 즉시 프로그램이 닫힙니다.
print ('Lets do some math nerd!')
print ('How many problems would you like to solve?')
cycle = int(input())
rep = 0
while cycle < rep;
rep = rep + 1;
print ('What operation would you like to perform?')
print('Press 1 for Addition')
print('Press 2 for Subtraction')
print('Press 3 for Multiplication')
print('Press 4 for Division')
op = int(input())
if op ==1
print ('Enter your first number.')
num1 = int(input())
print ('Enter your second number.')
num2 = int(input())
result = (num1 + num2)
print result
elif op ==2
print ('Enter your first number.')
num1 = int(input())
print ('Enter your second number.')
num2 = int(input())
result = (num1 - num2)
print result
elif op ==3
print ('Enter your first number.')
num1 = int(input())
print ('Enter your second number.')
num2 = int(input())
result = (num1 * num2)
print result
elif op ==4
print ('Enter your first number.')
num1 = int(input())
print ('Enter your second number.')
num2 = int(input())
result = (num1/num2)
print result
else
print ('ERROR')
print (Please select a number 1 through 4.')
print ('Thanks for using my calculator!')
closeInput = raw_input("Press ENTER to exit")
print "Closing..."
그냥 대신 클릭의 콘솔에서 코드를 실행이. 창은 사라지지 않을 것입니다, 당신은 예외를 볼 수있을 것이다하시기 바랍니다 –
이것은 올바르지 않을 수 있습니다 :'while cycle
어떻게 실행합니까? Windows 시스템을 사용하는 경우 , 그리고 파이썬 파일을 더블 클릭하면 그 일이 일어날 것입니다. 대신 명령 프롬프트를 열고'python myfile.py'을 실행하십시오 – karthikr