Apr-09-2020, 04:58 PM
The problem is with your input. If you look at the Traceback, you should see the error raised. 'ValueError:' Capturing the error in your try/except blocks will allow you to see just what the offending line is.
except IOError: print("File doesn't exist cannot perform operations on the file") except ValueError: print("Invalid input:") print(repr(line)) else: print("No of items purchased:".format(ItemsPurchased)) print("No of free items:".format(FreeItems)) print("Amount to pay:".format(totalAmount)) print("Discount given:".format(Discount)) print("Final Amount paid:".format(FinalAmount))