The first function is used to ask for an input that is numerical and has not more than 1 decimal point. the first function checks to see if it is numerically valid, and the second function takes a cash amount and displays the minimum amount of coins you would get back. I am having trouble getting my first function to use the new inputs in the second function. It askes for the input but uses the original errored one. If anyone could help, Thank you
import math
def isFloat(get_float):
check = get_float.split(".")
length = len(check)
for i in check:
try:
get_float = input("Error: Re Enter Amount Owed $ ")
except ValueError:
print("Sorry, that is invalid")
if length > 2:
return isFloat(get_float)
elif length == 2:
if check[0].isnumeric() == False or check[1].isnumeric() == False:
return isFloat(get_float)
if check[0].isnumeric() == True and check[1].isnumeric() == True:
return True
elif length == 1:
if not i.isnumeric():
return isFloat(get_float)
else:
return True
def cash(get_float):
negative = get_float.count("-")
while negative > 0:
get_float = input("Invalid syntax ")
negative = cost.count("-")
Quarters = 0.25
Dimes = 0.10
Nickels = 0.05
Pennies = 0.01
list = {Quarters: 0, Dimes: 0, Nickels: 0, Pennies: 0}
owed = float(get_float)
rounded = round(owed * 100)
print("Change Owed back to you: " + "$" + str(rounded / 100))
if get_float < get_float:
print("InsufficientFunds")
else:
for changeType in list:
Amount = max(0, owed // changeType)
owed = owed - Amount * changeType
list[changeType] = int(Amount)
print("Minimum coins given back -", list)
get_float = input("Amount Owed $")
isFloat(get_float)
cash(get_float)