Stupis af | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Stupis af

Can please someone explain whats behind this calculation? What is the output of this code? >>> x = 5 >>> y = x + 3 >>> y = int(str(y) + "2") >>> print(y) thx...

18th Jun 2017, 8:41 AM
UHééUH
UHééUH - avatar
1 Answer
+ 2
X=5. >5 Y=X+3. >8 because 5 + 3 = 8 str(y) makes the y value a string so it's "8" now "8"+"2" = "82" because it's a string + a string int("8"+"2") makes the 82 an int thus y = 82 print(y) >>> 82
18th Jun 2017, 8:49 AM
Limitless
Limitless - avatar