'Casting irresponsive
Tried to do casting on this little project I am working on can anyone tell me what I have done wrong?
Calculation_to_units = 24
name_of_unit = "hours"
def days_to_units(num_of_days):
if num_of_days > 0:
return f"{num_of_days} days are {num_of_days * Calculation_to_units} {name_of_unit}"
else:
return "You enter a negative value, so no conversion can happen"
user_input = input("Hey user, enter the number of days and i will convert it into hours\n")
user_input_number = int(user_input)
calculated_value = days_to_units(user_input_number)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
