What is the output of the expression print(5 % 2) in Python?

Prepare for the Leaving Certificate Computer Science Test with a mix of flashcards and multiple choice questions, each designed to enhance learning. Discover tips and resources for success. Ace your exam with confidence!

The expression 5 % 2 in Python utilizes the modulo operator %, which calculates the remainder of the division between two numbers. When you divide 5 by 2, the quotient is 2 with a remainder of 1. Therefore, the result of this operation is 1, which means that the output of print(5 % 2) will indeed display 1. Understanding the modulo operation is key here, as it allows one to determine how much is left after division rather than the result of the division itself.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy