+ 1
I don't understand how 82 is the solution to this problem. please explain. thanks so much.
x = 5 >>> y = x + 3 >>> y = int(str(y) + "2") >>> print(y)
6 Respuestas
+ 5
y = 5+3 = 8
str(y) = "8"
"8" + "2" = "82" // string concatenation
int("82") = 82
+ 1
Sandra Smith you have explicitly converted y=int(str(y)+"2") to integer type, which will convert the parameter. Before that, python accept everything as String. Try removing int par and print(y). You could also use type keyword to find the datatype of y, like, print(type(y)). Thank you
0
You've converted y to a string so now you're no longer dealing with numbers. They look like numbers but are being treated the same as a string. For example:
"Hello "+"World" = Hello World
"8" + "2" = 82
0
Thank you all so, so very much!