Eorror Here I am trying to get this code to run and accept decimals in the input/avoids the EOFError as the program calls an syntax if I remove the except code which I do not need. Is there another way I should be writing the loop?
def getWage(self):
while True:
try:
self.wages = float(input("Enter your hourly wage: "))
if self.wages <= 0:
print("Value must be a number greater than 0!")
continue
except EOFError:
print("Value must be a number greater than 0!")
continue
else:
return self.wages
Whole code currently:
def getWage(self):
while True:
try:
self.wages = float(input("Enter your hourly wage: "))
if self.wages <= 0:
print("Value must be a number greater than 0!")
continue
except EOFError:
print("Value must be a number greater than 0!")
continue
else:
return self.wages