ProgrammingModerateTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
x = 12
x //= 5
y = 12
y /= 5
print(x, y, type(x).__name__, type(y).__name__)
  1. A. 2.4 2.4 float float
  2. B. 2 2.4 float float
  3. C. 2 2.4 int float
  4. D. 2 2 int int

Correct answer: C. 2 2.4 int float

//= keeps an int result, 2. /= always gives a float, 2.4. So x is an int and y is a float.

More Python Programming questions

Exams that ask this topic