'Basic Python Quetion [closed]
You heard from TV news that the current temperature outside is 25 degrees. What is the output of the following program? *
weather = "windy"
if temperature < 0 or weather == "rainy":
print ("Not a perfect day for running..")
elif weather == "cloudy":
print ("There might be a chance to rain, so I'll stay home today.")
elif temperature › 30:
print ("Too hot for running..")
else:
print("I am going out for running now!")
I think it is "I am going out~" But it said this one is an error.. I don't know why
Solution 1:[1]
The reason that you're getting an error is because › ( temperature › 30) operator doesn't exist in python. You can use greater than symbol > instead. And, we believe that you defined temperature as 25 in your code.
Solution 2:[2]
may be add this:
....
elif temeprature < 30 and temeprature > 20:
print ("I am going out for running now!")
else:
print ("Too hot for running")
....
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Python learner |
| Solution 2 | Janib Soomro |
