I need to code a get_input function that has loop validation so the number cannot be less than 0
This is the program. ive made this a global function but my instructor told me it was wrong. Making get_input
a global function seems to work but i need to use the means of
def get_input():
get_input()
Ive been setting up the global function as get_input = input just because i have no clue how to do what i posted above without geting the error "global name is not defined".
Any help would be greatly appreciated
get_input = input
def main():
pennies = get_input("Enter pennies : ")
nickels = get_input("Enter nickels : ")
dimes = get_input("Enter dimes : ")
quarters = get_input("Enter quarters : ")
print("You entered : ")
print("\tPennies : " , pennies)
print("\tNickels : " , nickels)
print("\tDimes : " , dimes)
print("\tQuarters : " , quarters)
total_value = get_total(pennies, nickels, dimes, quarters)
dollars = get_dollars(pennies, nickels, dimes, quarters)
left_over_cents = get_left_over_cents(pennies, nickels, dimes, quarters)
print("Total = $", total_value, sep="")
print("You have", dollars, "dollars and", left_over_cents, "cent(s)")
main()