Exercise 4: Fix the Crash — Possible Solution ==================================================================== # The original line: # print("You have " + 3 + " new messages") # crashes with TypeError: can only concatenate str (not "int") to str # — Python's + operator refuses to mix a string and an int, unlike # Java or JavaScript, which would silently convert 3 to "3" for you. # Fix 1 — concatenation, with an explicit str() around the number print("You have " + str(3) + " new messages") # Fix 2 — f-string, no str() needed at all print(f"You have {3} new messages") Output: You have 3 new messages You have 3 new messages WHY THIS WORKS AS AN ANSWER ------------------------------ The crash happens because + is Python's string-concatenation operator ONLY when every operand is already a string — it has no built-in "stringify this for me" behaviour the way Java's + or JavaScript's + does. str(3) converts the integer to the string "3" first, which makes every operand in the expression a string and lets + succeed. The f-string version sidesteps the whole problem: {3} is evaluated and converted to text automatically by the f-string machinery, so there's no + operator involved at all and nothing to crash.