Please help why am I getting these errors in python, what am I missing?? Function 1: Error: Function 2: Error:
Posted: Sun May 15, 2022 11:45 am
Please help why am I getting these errors in python, what am
I missing??
Function 1:
Error:
Function 2:
Error:
def get-payment(to_pay: float) -> float: cash_or_card = 11 if float(to_pay) > 100.00: change_amount = "0.00" rounding amount = "-0.00" print("Payment by credit card only.\n") return to pay while (True): cash_or_card = str(input("Pay by cash or credit card: ")).strip().lower() if cash_or_card != "cash" and cash_or_card != "card": continue else: break if cash_or_card == "cash": received = get_cash (to_pay) return received if cash_or_card == "card": change_amount = "0.00" rounding amount = "-0.00" return to_pay
test_get_payment_02 Х EOFError: EOF when reading a line Hide stacktrace File "/tmp/test_krusty.py", line 137, in test_get_payment_62 self.run_get_payment_test(test_num, to_pay) File "/tmp/test_krusty.py", line 117, in run_get_payment_test actual = krusty.get_payment(to_pay) File "/home/krusty.py", line 106, in get_payment cash_or_card = str(input("Pay by cash or credit card: ")).strip().lower() tort got cach?
def get_cash (minimum_cash:int) -> int: cash_value_sum = 8 while True: cash_value = float(input("Enter cash: )) if(not (is_cash(cash_value))): print("Invalid banknote!") continue cash_value_sum = cash_value_sum + cash_value print(f"Payment received: ${cash_value_sum: .2f}") if float(cash_value_sum) >= float(minimum_cash): break return cash_value_sum
v test_get_cash_03 Х ValueError: could not convert string to float: " Hide stacktrace File "/tmp/test_krusty.py", line 184, in test_get_cash_03 self.run_get_cash_test(test_num, to_pay) File "/tmp/test_krusty.py", line 159, in run_get_cash_test actual = krusty.get_cash(minimum_cash) File "/home/krusty.py", line 85, in get_cash cash_value = float(input("Enter cash: "))
I missing??
Function 1:
Error:
Function 2:
Error:
def get-payment(to_pay: float) -> float: cash_or_card = 11 if float(to_pay) > 100.00: change_amount = "0.00" rounding amount = "-0.00" print("Payment by credit card only.\n") return to pay while (True): cash_or_card = str(input("Pay by cash or credit card: ")).strip().lower() if cash_or_card != "cash" and cash_or_card != "card": continue else: break if cash_or_card == "cash": received = get_cash (to_pay) return received if cash_or_card == "card": change_amount = "0.00" rounding amount = "-0.00" return to_pay
test_get_payment_02 Х EOFError: EOF when reading a line Hide stacktrace File "/tmp/test_krusty.py", line 137, in test_get_payment_62 self.run_get_payment_test(test_num, to_pay) File "/tmp/test_krusty.py", line 117, in run_get_payment_test actual = krusty.get_payment(to_pay) File "/home/krusty.py", line 106, in get_payment cash_or_card = str(input("Pay by cash or credit card: ")).strip().lower() tort got cach?
def get_cash (minimum_cash:int) -> int: cash_value_sum = 8 while True: cash_value = float(input("Enter cash: )) if(not (is_cash(cash_value))): print("Invalid banknote!") continue cash_value_sum = cash_value_sum + cash_value print(f"Payment received: ${cash_value_sum: .2f}") if float(cash_value_sum) >= float(minimum_cash): break return cash_value_sum
v test_get_cash_03 Х ValueError: could not convert string to float: " Hide stacktrace File "/tmp/test_krusty.py", line 184, in test_get_cash_03 self.run_get_cash_test(test_num, to_pay) File "/tmp/test_krusty.py", line 159, in run_get_cash_test actual = krusty.get_cash(minimum_cash) File "/home/krusty.py", line 85, in get_cash cash_value = float(input("Enter cash: "))