Menu

I understimated debugging, it was a mistake
📰
0

I understimated debugging, it was a mistake

DEV Community·arpy·about 1 month ago
#ScpZw4cv
Reading 0:00
15s threshold
Cover image for I understimated debugging, it was a mistake

arpy

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)

Read More