Post

@Python_Dv Answer is A
a = “7” is a string
a +=“2” is same as a=a+”2”
Which a is = “7” +”2”
a = “72”
You can’t perform addition on strings but concatenation
So t= int(“72”) *2
int converts a string to an int
So t = 72 * 2
t = 144
So a float of (144) is equals to 144.0 🙂
English

@Python_Dv A. 144.0
a+= "2" also means a = a + "2". When substituted, we have a = "7" + "2", which is "72" because they are both string data types. And string doesn't allow for maths ops.
t = int(a)*2 converts "a" back to integer. And it's printed in float which means decimal number.
English

@Python_Dv The correct option is A) 144.0.
Step 1: Initialize the variable a
The variable a is initialized as a string with the value "7".
a = "7"
Step 2: Concatenate a string to a
The += operator is used to concatenate the string "2" to the existing string in variable a. The
English

@Python_Dv answer is a coz
1) first we concatenate "7" with "2" which becomes "72)
2) Then we convert it into integer through casting and multiply by two and store it into variable t
3) Then we print its corresponding float value
English

@Python_Dv The first two steps produce the string "72".
Then you convert it to an integer and multiply by 2, resulting in 144.
Finally, when printing, you cast it to a float, so the output becomes 144.0.
English

@Python_Dv A) 144.0
Those who are confused about a+="2" will give error, it will not.
the reason is, python accepts addition assignment for string too.
it acts like simple string concatenation.
so, a will become -> "72"
then convert and * 2 = t = 144
then convert into float 144.0 & print
English

@Python_Dv C)144; since 7 and 2 are strings "7"&"2" at a+=2 means a=a+2 so, both that strings gets combined and new string is formed "72" then, int(a) converts it into 72 number then ×2 =144 in floate its =144.0
English

@Python_Dv C
a='7'
then
a ='72'
which will be turned into an integer by value 72
*2 = 144
English

@Python_Dv 144.0
Explanation 👇🏻
> a is assigned as a string : “7”
> then “7” + “2” becomes “72” : because python does not perform maths on strings it just concatenates them
> it is then explicitly converted to integer datatype : 72 and multiplied by 2
> printed in decimal format at last
English

@Python_Dv String addition => "72"
Type-casting & multiplication => 144
Type-casting and to stdout => 144.0
English

@Python_Dv @grok spoil the fun for us,
I think the answer is 144.0
English

@Python_Dv It is 144.0
First a concatenation ("72")
So a mult between an instance int of value 72 and int instance of value 2, resulting int 144
Then the int 144 is used to create a new instance of float with value of 144.0
English

@Python_Dv # 144.0
No one read the instructions.. They said "comment your answers below"
English























