Как я могу запретить моему Python exe-файлу закрывать окно после завершения задачи? - PullRequest
0 голосов
/ 27 января 2020

Я назначил еженедельный калькулятор сбережений, и после генерации exe-файла и его запуска он откроет cmd, запросит необходимые входные данные и закроется сразу после выполнения расчетов и отображения списка. Я хотел бы, чтобы окно программы оставалось открытым при отображении списка, чтобы пользователь мог делать заметки при желании.

weeks = []
#Creates a list with each week's amount for the selected number of periods.
def create_list(amount, periods):
    counter = 0
    savings = 0
    while (counter < periods):
        savings += amount
        weeks.append(savings)
        counter += 1
#Formats each item in the list and prints it separately.
def display(lists):
    i = 1
    for entry in lists:
        print ("On period {} you should deposit ${} ".format(str(i), entry))
        i += 1

def main():
    amount = int(input("Enter savings amount you want to start with: "))
    periods = int(input("For how many periods do you want to save?: "))
    print()
    create_list(amount, periods)
    display(weeks)
    total = sum(weeks)
    print ("\nAfter {} periods you will have ${} saved.".format(periods, total))

main()   
...