Skip to content
Worked Examples · Example 5.16
Q.

Example 5.16:

StatementOutput
print("Hello")Hello
print(10*2.5)25.0
print("I" + "love" + "my" + "country")Ilovemycountry
print("I'm", 16, "years old")I'm 16 years old
Yanam BieapTextbookSubjective· 2mImportance★★★★★est
55% · 27/49 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

The four statements demonstrate how print() handles a plain string, an arithmetic expression, string concatenation with +, and comma-separated mixed-type items.

The idea (Data Type Conversion and print() behaviour). print() first evaluates whatever is inside the parentheses, converts each resulting value to its text form, and then displays it. How the values get joined depends on whether you used + (an operator applied before printing) or , (a separator applied by print() itself).

Let us verify each row of the table:

print("Hello")
print(10*2.5)
print("I" + "love" + "my" + "country")
print("I'm", 16, "years old")
Hello
25.0
Ilovemycountry
I'm 16 years old

Row-by-row reasoning

  1. print("Hello") — a string literal is displayed as its contents; the enclosing quotes are part of the syntax, not the value, so the output is Hello (no quotes).
  2. print(10*2.5) — the expression 10*2.5 is evaluated first. Multiplying an int by a float makes Python implicitly convert the int to float, so the result is the float 25.0, and that is exactly what is printed — not 25.
  3. print("I" + "love" + "my" + "country") — for strings, + means concatenation. It glues the pieces together exactly as given, adding nothing in between, so the output is Ilovemycountry (no spaces, because the strings themselves contain none). …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.