May-27-2020, 10:56 AM
(This post was last modified: May-27-2020, 10:57 AM by pyzyx3qwerty.)
Please use proper code tags while posting a thread.
The problem is python can't just join a string and an integer together, because they are two different things and hence Python has no clue - should it add them like an integer or join them like a string ??
So there are 2 ways to defeat this -
The problem is python can't just join a string and an integer together, because they are two different things and hence Python has no clue - should it add them like an integer or join them like a string ??
So there are 2 ways to defeat this -
- First, you can change the integer into a string, like
print('hello ' + name + ' you are ' + str(age) + " years old")
OR
- You can use commas -
print('hello ' , name , ' you are ' , age , " years old")
str
in python. Numbers that don't have a decimal point are integers and are called int
in python.
pyzyx3qwerty
"The greatest glory in living lies not in never falling, but in rising every time we fall." - Nelson Mandela
Need help on the forum? Visit help @ python forum
For learning more and more about python, visit Python docs
"The greatest glory in living lies not in never falling, but in rising every time we fall." - Nelson Mandela
Need help on the forum? Visit help @ python forum
For learning more and more about python, visit Python docs