Code :
a = 10
if a = 30 or 40 or 60 :
print('Hello')
else :
print('Hi')
Solution and Explanation:
Answer : Error
The equality comparison should use == instead of =. Second, you need to compare the variable a against each value separately. Here's the corrected version:
a = 10
if a == 30 or a == 40 or a == 60:
print('Hello')
else:
print('Hi')
This way, it checks if a is equal to any of the specified values (30, 40, or 60) and prints 'Hello' if true, otherwise, it prints 'Hi'.
0 Comments:
Post a Comment