J
James
asked

Expert
Kelish Rai answered
Yes, strings and numbers are different in terms of how different operations work on them. For example,
Numbers are used for mathematical calculations.
print(5 + 5) # Output: 10
Strings are just text, even if they contain numbers.
print("5" + "5") # Output: "55"
When you put numbers inside quotes, Python treats them as text instead of numbers. That’s why "5" + "5" gives "55" instead of 10—because Python is joining two strings together, not adding numbers.
Also, you'll learn these operations in the upcoming lessons.
Hope this helps. If you have a follow-up question, feel free to let me know. I'm happy to help.
Python
This question was asked as part of the Getting started with Python course.
Our Experts
Sanjeev PanditPrincipal Engineer
Sudip BhandariHead of Growth/Marketing
Apekchhya ShresthaSenior Product Manager
Anuj ShresthaTech Lead
Kelish RaiTechnical Content Writer
Abhilekh GautamSystem Engineer
Palistha SinghTechnical Content Writer
Sarthak BaralSenior Content Editor
Saujanya Poudel
Abhay Jajodia
Nisha SharmaTechnical Content Writer
Udayan ShakyaTechnical Content Writer