4
Question Question 4
What is the error in following code? Correct the code:
weather = 'raining'
if weather = 'sunny' :
print ("wear sunblock")
elif weather = "snow":
print ("going skiing")
else :
print (weather) In this code, assignment operator (=) is used in place of equality operator (==) for comparison. The corrected code is below:
weather = 'raining'
if weather == 'sunny' :
print ("wear sunblock")
elif weather == "snow":
print ("going skiing")
else :
print (weather)