나는 파이썬 가속 계산기를 만들었지 만 문제는 프로그램이 처음이나 종료로 돌아가는 것입니다. 사용자가 '1'을 누르고 계산기를 다시 시작하거나 '2'를 누르고 프로그램을 종료 시키길 원합니다. 프로그램이 방정식을 통과 한 후에 내 주요 기능을 실행하는 방법을 알아낼 수 없습니다. 감사. 귀하의 들여 쓰기가 잘못내 가속 계산기를 파이썬으로 다시 시작 하시겠습니까?
class equation():
def main():
Calc()
while True:
restart = input("Would you like to run again? If yes press '1' if you wish to Exit press '2'")
if restart==1:
Calc()
else:
print "Goodbye"
break
print "What is your Velocity: "
v = float(input()) #m/s
print "What is your Intial Velocity: "
u = float(input()) #m/s
print "What is the time: "
t = float(input()) #Seconds
aa = v-u
answer = aa/t
eq=equation()
print "Your Acceleration is: ", eq.answer, "m/s^2"
print eq.main
'restart == '1':'그러면 작동하고 파이썬 2,7이면 raw_input을 사용합니다. –