asked 1.7k views
1 vote
What is output?

x = 21
if (x > 21):
print (1)
elif (x < 21):
print (2)
else:
print (3)

asked
User Andynu
by
8.2k points

1 Answer

2 votes

Answer:

The output of the following code is 3.

Step-by-step explanation:

In the following Python Programming Language, the output is 3 because the variable x is equal to 21, then the user check the condition is the variable x is greater than 21 then print it print 1, otherwise the user check that the variable x is less than 21 then print 2, otherwise it print 3. So, the variable x is not greater than 21 or not less than 21, it is equal to 21. That's why the code execute the else block and print 3.

answered
User SCha
by
7.8k points