0
type conversion in python
why result of this statement is 34 ? why not 7 ? int("3" + "4")
1 Answer
+ 1
Remember that in Python you can concatenate strings.
For example:
print(âSoloâ + âlearnâ)
# Output: Sololearn
This works even if your strings contain numbers.
For example:
print(â2â + â2â)
# Output: 22
# Here â22â is a string
print(int(â2â + â2))
# Output: 22
# Here â22â is an integer