- 11

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

19th Jun 2018, 8:46 AM
Shruti Sharma
Shruti Sharma - avatar
19 Respuestas
+ 11
You are concatenating two strings together, then coverting them to an integer. Therefore, your output will be 82.
19th Jun 2018, 10:59 AM
Jason Wilson
Jason Wilson - avatar
+ 3
thanks everyone
19th Jun 2018, 11:00 AM
Shruti Sharma
Shruti Sharma - avatar
+ 2
string concatenation is working here, '8' + '2' = '82'
19th Jun 2018, 3:56 PM
ghali lawal
ghali lawal - avatar
+ 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)
28th Feb 2020, 9:21 AM
Amanda Gxagxa
Amanda Gxagxa - avatar
+ 1
a = 5 b = 9 x = str(a) y = str(b) print(x+y)
31st Oct 2022, 8:44 PM
Daniel Kulimushi
Daniel Kulimushi - avatar
0
82
19th Jun 2018, 6:21 PM
Aram
0
What is the output of this code and explain how X= 9.34 Y=int(X) Print(Y)
18th Dec 2022, 2:13 PM
Mohd Imran
0
What's the output of this code? x = 5 y = x + 3 y = int(str(y) + "2") print(y) 82
21st Apr 2023, 5:38 AM
Jembere Guta
Jembere Guta - avatar
0
X = "10" Y = 5 Z = x + str(y) Print(z) Answer please
29th Jul 2023, 3:45 PM
Edward Brown
Edward Brown - avatar
- 1
thanks for your help i was stuck on this problem lmao :)))))) xD xoxo
26th Feb 2020, 5:37 PM
Febnin & Matthew
Febnin & Matthew - avatar
- 1
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
26th Oct 2020, 8:50 AM
pmalod
pmalod - avatar
- 1
82
19th Dec 2020, 4:27 AM
laksh mahashitti
laksh mahashitti - avatar
- 1
82
17th Apr 2021, 10:28 AM
王可麟
王可麟 - avatar
- 1
82
27th Aug 2021, 12:24 PM
PRINCE KUMAR
PRINCE KUMAR - avatar
- 1
this is so dumb like wtf is this
26th Dec 2021, 1:04 PM
mxstyfy
- 2
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 ?
19th Jun 2018, 8:48 PM
Aram
- 2
x = 4 x + = 5
30th Nov 2020, 4:37 AM
Leonardo Espinosa Romero
Leonardo Espinosa Romero - avatar
- 4
X=5 Y=x+3 Y=int(str(y)+"2") print(y)
6th Apr 2020, 1:03 PM
Yeswanth Kota
Yeswanth Kota - avatar