0

type conversion in python

why result of this statement is 34 ? why not 7 ? int("3" + "4")

27th Nov 2018, 3:15 AM
Seyed Ebrahim Khadem
Seyed Ebrahim Khadem - avatar
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
27th Nov 2018, 3:40 AM
Diego
Diego - avatar