#re-write to allow function call several times: #ask user to enter Y or N, Y - to continue to calculate the dollar amount #and N will stop the program import random def change(q, d, n, p): return (q*0.25+d*0.10+n*0.05+p*0.01) def main(): letter=input("enter Y to continue and N to stop ") while(letter!='N'): q=random.randint(1,4) d=random.randint(1,4) n=random.randint(1,4) p=random.randint(1,4) print(q,d,n,p) print("final dollar amount", change(q,d,n,p)) letter=input("enter Y to continue and N to stop ") main()