Спросите пользователя, хотят ли они повторить ту же задачу снова

Если пользователь доходит до конца программы, я хочу, чтобы ему предложили ответить на вопрос, хотят ли они повторить попытку. Если они ответят да, я хочу перезапустить программу.

import random
print("The purpose of this exercise is to enter a number of coin values") 
print("that add up to a displayed target value.\n") 
print("Enter coins values as 1-penny, 5-nickel, 10-dime,and 25-quarter.") 
print("Hit return after the last entered coin value.")
print("--------------------") 
total = 0 
final_coin = random.randint(1, 99)
print("Enter coins that add up to", final_coin, "cents, on per line") 
user_input = int(input("Enter first coin: "))
total = total + user_input

if user_input != 1 and user_input!=5 and user_input!=10 and user_input!=25:
   print("invalid input")

while total != final_coin:
    user_input = int(input("Enter next coin: "))
    total = total + user_input

if total > final_coin:
    print("Sorry - total amount exceeds", (final_coin)) 

if total < final_coin:
    print("Sorry - you only entered",(total))

if total== final_coin: 
    print("correct")

Ответы на вопрос(2)

Ваш ответ на вопрос