I did simple python function which takes two inputs and output some text.
Here it is,
def weather():
israining_str=input("Is it raining (1 or 0) ? ")
israining = bool(israining_str)
temp_str=input("What is the temp ? ")
temp = float(temp_str)
if israining==True and temp<18:
return "Umbrella & Sweater"
elif israining==True and temp>=18:
return "Umbrella"
elif israining==False and temp<18:
return "Sweater"
else:
return "Cap"
Test data -
>>>
Is it raining ? 0
What is the temp ? 43
Umbrella
>>> ================================ RESTART ================================
>>>
Is it raining ? 1
What is the temp ? 43
Umbrella
>>>
If raining is false it shroud give Sweater or Cap. But my code gives true even israining_str == 0 or israining_str == 1
Where am i doing wrong ?