+ 1

X=3 , y=x+3, y=int(str(y)+"2") print(y)????

I can't find correct answer please help me

7th Jun 2018, 9:49 PM
Hamza
Hamza - avatar
14 odpowiedzi
+ 4
x=3 (3) y=3+3 (6) y=int(str(y)+"2") y=y converted to a string ("6")+"2" so y = "6"+"2" ("62"), since it takes the numbers as tokens, and not numbers
7th Jun 2018, 10:07 PM
Roel
Roel - avatar
+ 3
thanks s lot
7th Jun 2018, 10:08 PM
Hamza
Hamza - avatar
+ 1
62
8th Jun 2018, 9:19 AM
SAURABH YADAV
SAURABH YADAV - avatar
+ 1
x=5 y=x+3 y=int(str(y)+"2") print(y) that Q in Quez I tried 82 redused what's correct answer
8th Jun 2018, 12:19 PM
Hamza
Hamza - avatar
+ 1
I tried 82 but wrong
8th Jun 2018, 1:24 PM
Hamza
Hamza - avatar
0
or maybe if the str means the string of whats inside the brackets it would be y2 but i think its the value of y converted to a string
7th Jun 2018, 10:08 PM
Roel
Roel - avatar
0
no problem, but i can be wrong since im not programming with python since 3 months ago
7th Jun 2018, 10:09 PM
Roel
Roel - avatar
0
wait thats another case here it strings y so it will be "y"+"2" so here it will be y2
8th Jun 2018, 1:28 PM
Roel
Roel - avatar
0
u tried 62 faild
8th Jun 2018, 1:28 PM
Hamza
Hamza - avatar
0
i misunderstood the str() function it strings everything inside the brackets so it would string the character y here
8th Jun 2018, 1:34 PM
Roel
Roel - avatar
0
x = 5 y = 5 + 3 y = int(str("8") + "2") print(y) Output is 82. because the Y value is becoming as string in 3rd line thank you
17th Dec 2020, 8:11 AM
PAVIKUMAR T
PAVIKUMAR T - avatar
0
82 is correct answer
27th Feb 2021, 5:39 AM
v manojbabu
v manojbabu - avatar
0
correct answer = 82
28th Mar 2021, 6:59 PM
Ben Jnr
Ben Jnr - avatar
0
correct answer =82
18th May 2021, 4:05 PM
احمد ابراهيم سلمان عبد الحسن
احمد ابراهيم سلمان عبد الحسن - avatar