In a file called coke.py, implement a program that prompts the user to insert a coin, one at a time, each time informing the user of the amount due. Once the user has inputted at least 50 cents, output how many cents in change the user is owed. Assume that the user will only input integers, and ignore any integer that isn’t an accepted denomination.
Why does the amount_Due function return None not owed value when owed == 0
def main():
owed = 50
coin = check(owed)
rem = amount_due(coin, owed)
print(f"Change Owed: {rem}")
# check if the inserted coin is from coins or not
def check(owed):
coins = [25, 10, 5]
while True:
print(f"Amout Due: {owed}")
coin = int(input("Insert Coin: ").strip())
if coin in coins:
return coin
# calculate the remaning
def amount_due(coin, owed):
owed -= coin
if owed <= 0:
return owed
else:
amount_due(check(owed), owed)
main()
if the coin in coins:will be run by the interpreter. Does the code produce an error?if the coin in coins:is invalid syntaxamount_due()does return an integer value. (The program just gives an incorrect answer, but that's something different.)