用于从头开始启动应用程序的Python代码

时间:2016-10-16 19:27:42

标签: python python-3.x conditional

我需要帮助,在从{a>开始再次启动应用的elif answer == "y":之后添加代码

answer = input("Run again? (y/n): ")
import sys
if answer == "n":
    print("Goodbye.")
    sys.exit   
elif answer == "y":

1 个答案:

答案 0 :(得分:1)

import sys

status = True
while(status):
    answer = input("Run again? (y/n): ")
    if answer == "n":
        status = False   
    elif answer == "y":
        status = True
print("Goodbye.")
sys.exit