On question 3/5 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

On question 3/5

howwww, I am bad with the math things, please help

6th Oct 2016, 1:54 AM
Peyton Stallings
Peyton Stallings - avatar
2 Answers
+ 1
x = 5 y = x + 3 print(str(y)+"2") so y = 8 (5 + 3) but when it prints y it first converts it to a string type (hence the str(y) part)... python will "add" two strings together by connecting them. "a" + "b" = "ab" just like "1" + "1" = "11". the answer is 82 because it takes the string version of y (8) and connects the string "2" to the end of it, giving us a string of "82".
6th Oct 2016, 2:26 AM
Luke Armstrong
0
why is it 82? will someone explain how the math goes down and what the commands mean
6th Oct 2016, 1:56 AM
Peyton Stallings
Peyton Stallings - avatar