0

I cant understand why ? a=int("3"+"4") print a it says wrong ?

16th Jul 2017, 8:31 PM
Mustafa Alfakeeh
Mustafa Alfakeeh - avatar
2 Réponses
+ 7
a=int("3"+"4") print(a) Output: 34 The reason is it is first adding the strings together, so 3 and 4 become "34" .. Then it makes it an int. Like math, inside ( ) happens first
16th Jul 2017, 8:34 PM
LordHill
LordHill - avatar
0
When you get an error, please paste it so that we don't have to guess. In Python 3, which is used by SoloLearn, print is a function, which therefore requires parentheses. Try: print(a)
16th Jul 2017, 9:27 PM
Igor B
Igor B - avatar