ProgrammingModerateTCS NQT · Infosys

What is printed?

What is printed?
print(str(3) + str(3.0), 3 + 3.0, '3' * 3 == '333')
  1. A. 33 6.0 True
  2. B. 33.0 6.0 True
  3. C. 33.0 6 True
  4. D. 33.0 6.0 False

Correct answer: B. 33.0 6.0 True

str(3.0) gives '3.0', so concatenating with '3' makes '33.0'. Adding an int and a float gives the float 6.0, and repeating the string 3 times gives '333'.

More Python Programming questions

Exams that ask this topic