+ 3
How do I make my codes return output when zero is inputed
2 Answers
+ 7
Wisdom Ademiju ,
keeping as much as possible from your code, you could do it like this :
calc_formula = 24
calc_unit = "hours"
def calc_ulator(num_days):
if num_days != 0:
return f"{num_days } days have {calc_formula * num_days } {calc_unit }"
else:
return f"you entered zero, theres nun like zero days fam :)"
user_input = input("hey user, input number of days and i will convert to hours\n")
if user_input.isdigit():
user_input_number =int(user_input)
print(calc_ulator (user_input_number))
else:
print ("wrong input,please input a valid number of days")
+ 3
Lothar thanksđ