Variables, Types & Operators · Question 13 · Medium

Python 3's round() is called on two values that end in .5. What does this print?

print(round(2.5), round(3.5))
  1. 3 4
  2. 2 3
  3. 2 4
  4. 3 3
Answer and explanation

Answer: C. 2 4

Explanation: Python 3 rounds a value exactly halfway to the nearest even integer. 2.5 goes to 2 and 3.5 goes to 4.

Previous: Two separate lists hold the same values and a third name points to the first… · Next: A string holding a decimal number is passed straight to int(). What is the…

Practise variables, types & operators

Try a fresh set of variables, types & operators questions with an explanation after every answer, free and without signing up: Variables, Types & Operators practice. Or sit a full placement mock test.

More variables, types & operators questions

More python practice

Python Strings · Lists & Tuples · Dictionaries & Sets · Conditions & Loops · Functions & Scope · Comprehensions & Generators · Classes & Objects · Exceptions & Files

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge