What is the output of this code? >>> x = 5 >>> y = x + 3 >>> y = int(str(y) + "2") >>> print(y) | Sololearn: Learn to code for FREE!

-9

What is the output of this code? >>> x = 5 >>> y = x + 3 >>> y = int(str(y) + "2") >>> print(y)

6/19/2018 8:46:35 AM

Shruti Sharma

15 Answers

New Answer

+8

You are concatenating two strings together, then coverting them to an integer. Therefore, your output will be 82.

+3

thanks everyone

+3

string concatenation is working here, '8' + '2' = '82'

+2

The answer is not 42 but 82.

+1

The answer is 82. Why? : //The value of x is 5 >>> x = 5 //now y is 5 +3 i.e 8 >>> y = x + 3 so this line is changing 8 to a string and concatenate that string 8 to string 2 , then convert the string "82" to an integer int(str(y) + "2") >>> print(y)

0

0

thanks for your help i was stuck on this problem lmao :)))))) xD xoxo

0

Pour cette question le bon code est : x = (5) y = (x + 3) y = int(str(y) + "2") print(y) Sinon ça ne fait pas 82 mais error

0

0

0

-1

What is the answer for the question after. File in the blank to declare a variable, add 5 to it and print it value x = 5 X —— = 4 Print —— I forgot this part any help ?

-1

-1

https://www.google.com/imgres?imgurl=https%3A%2F%2Fen.meming.world%2Fimages%2Fen%2Fthumb%2F0%2F03%2FGood_Question.jpg%2F300px-Good_Question.jpg&imgrefurl=https%3A%2F%2Fen.meming.world%2Fwiki%2FGood_Question&tbnid=N9CA8NB5-uGcuM&vet=12ahUKEwi5vdDi3cntAhXJHN8KHS35Dq8QMygAegUIARCkAQ..i&docid=AFcaDbXhOLKWCM&w=300&h=210&q=shrek%20good%20question&safe=active&ved=2ahUKEwi5vdDi3cntAhXJHN8KHS35Dq8QMygAegUIARCkAQ&surl=1

-2

X=5 Y=x+3 Y=int(str(y)+"2") print(y)