Post

Python Developer
Python Developer@PythonDvz·
Comment your answers below! 👇
Python Developer tweet media
English
45
16
185
26.7K
~TJ~
~TJ~@tjsociety_·
@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
0
0
14
600
Omo Yewa
Omo Yewa@AceKelm·
@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
0
0
9
1.5K
Earnest Codes
Earnest Codes@Earnesto037·
@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
1
0
3
1.1K
Punya Singh
Punya Singh@TerrificPunnu·
@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
0
0
2
1K
BERRAK BAŞAK
BERRAK BAŞAK@BerrakBasak_·
@Python_Dv a=“7” a+”2”=72 t=72*2=144 Float(144)=144.0 =144.0
English
0
0
2
57
Manu Jemini
Manu Jemini@ManuJemini·
@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
0
0
1
519
Shuvo Sarker
Shuvo Sarker@ssarkerdev·
@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
0
0
1
103
Atharv Ghorpade
Atharv Ghorpade@atharv_gho66071·
@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
0
0
0
209
Ayush
Ayush@iAyushCodes·
@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
0
0
0
714
ELKANAH
ELKANAH@Elkanah_builder·
@Python_Dv String addition => "72" Type-casting & multiplication => 144 Type-casting and to stdout => 144.0
English
0
0
0
93
Biel Men
Biel Men@BielMenHaha·
@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
0
0
0
577
Johnny Lee
Johnny Lee@J_Lee_23·
@Python_Dv # 144.0 No one read the instructions.. They said "comment your answers below"
English
0
0
0
279
Paylaş