🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Python Variables and Data Types: all 15 questions

Quiz: Python Variables and Data Types · Question 11 of 15

What does this print? (code)

What does this print?

print(int("12") + float("0.5"))
  1. A.120.5
  2. B.12.5
  3. C."12" + "0.5"
  4. D.An error
Answer & explanation

Correct answer: 12.5

Both strings are converted to numbers first, so this is 12 + 0.5.

Can you get the rest right without peeking?

Take the timed Quiz: Python Variables and Data Types quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →