0
Can someone explain this to me?
a = "7" a = a + "0" b = int(a) + 10 print(int(a)+b)
3 Respostas
+ 6
a=a+"10"
a="7"+"10" ,concatenates two strings
a="70"
b=int(a)+10
b=70+10 #int(a) converts string to int
b=80
print(int(a)+b)
a is still holding a string value ,i.e. "70" ,int again converts string to int and finally you get, 70+80=>150
+ 5
Use the tag your programming language you want help.
+ 3
a = "7" // string "7"
a = a + "0" // string "70" - addition of strings
b = int(a) + 10 // int 80 - a is converted to int
print(int(a) + b) // output 150 - addition of 2 intagers
I'm not sure what language this is... Seems like weird js/py