def valid(prompt, allow_zero=False): #why
while True:
try:
value = float(input(prompt))
if value and allow_zero >= 0:
return value
elif value and allow_zero > 0:
return value
else:
print("Invalid input. Please enter a valid number.")
except ValueError:
print("Invalid input. Please enter a valid number.")
return value #it took me 30min to realize that i should return the value from def not try:
df = pd.DataFrame([result])
print(df)
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)