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 🙂
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.
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
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
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.
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
🥚 Effortless Eggshell Opening! Crack eggs like a pro with the Egg Shell Opener! Perfect for soft or hard-boiled eggs, this handy tool makes breakfast easier than ever.
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
Want to make your wife melt? Turn your family into a custom wooden bear puzzle, engraved with love! She'll proudly display it at home. Click the video to shop now 💖
C a='7' then a ='72' which will be turned into an integer by value 72 *2 = 144
# 144.0 No one read the instructions.. They said "comment your answers below"
"72" as a string then make it into a into, no idea what the ascii is but im going with C on this now.
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
Error, string is immutable and can’t be lvalue of +=
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
United States Trends
- 1. Grammy 320K posts
- 2. Dizzy 9,444 posts
- 3. Clipse 19.1K posts
- 4. Kendrick 59.5K posts
- 5. #GOPHealthCareShutdown 5,472 posts
- 6. olivia dean 14.7K posts
- 7. addison rae 22.8K posts
- 8. AOTY 20.6K posts
- 9. Leon Thomas 18.7K posts
- 10. ravyn lenae 4,189 posts
- 11. Orban 32.6K posts
- 12. Katseye 114K posts
- 13. Alfredo 2 N/A
- 14. #FanCashDropPromotion 3,884 posts
- 15. lorde 12.2K posts
- 16. Kehlani 33.4K posts
- 17. gaga 98K posts
- 18. #FursuitFriday 11.8K posts
- 19. The Weeknd 12.1K posts
- 20. Carmen 47.3K posts
Something went wrong.
Something went wrong.