Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
age_text = "12" and age_number = 12. What is the difference? What do age_text + age_text and age_number + age_number give?
With text, + joins. With numbers, + adds.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, compare your working with the solution.
"12" is in quotation marks, so it is text (str). 12 is a number (int).+ joins: "12" + "12" is "1212".+ adds: 12 + 12 is 24.Answer: 1212 and 24. The same digits behave differently, because the types are different.
Log in to join the discussion.
Loading…