Ask Question
30 March, 16:20

What is output?

x = 21

if (x > 21):

print (1)

elif (x < 21):

print (2)

else:

print (3)

+2
Answers (1)
  1. 30 March, 20:12
    0
    The output of the following code is 3.

    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.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “What is output? x = 21 if (x > 21): print (1) elif (x < 21): print (2) else: print (3) ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers