0
type conversion in python
why result of this statement is 34 ? why not 7 ? int("3" + "4")
1 Réponse
+ 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