Ask Question
21 February, 19:52

What is output?

x = 21

if (x > 21):

print (1)

elif (x < 21):

print (2)

else:

print (3)

+1
Answers (1)
  1. 21 February, 20:05
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers