Post

Python Programming
Python Programming@PythonPr·
Python Question / Quiz; What is the output of the following Python code, and why? Comment your answers below!
Python Programming tweet media
English
33
9
224
40.3K
Kamal Gurjar
Kamal Gurjar@KamalGurjar8·
@PythonPr Output: B) 1010 ✅ Explanation: a is a string ("10"), not a number. In Python, multiplying a string by an integer repeats the string. So "10" * 2 → "1010" (string repetition, not arithmetic).
English
0
0
30
3.4K
Earnest Codes
Earnest Codes@Earnesto037·
@PythonPr Answer: B. 1010 In Python, when the multiplication operator (*) is used between a string and an integer, the string is repeated that many times. The variable a is assigned the string value "10". The variable b is assigned the integer value 2.
English
1
0
10
1.9K
Saket Kumar
Saket Kumar@SaketKumarX·
@PythonPr Output : 1010 ✅ a = "10" --> is a string not integer b = 2 --> is an integer print(a * b) --> printing string "10" two times --> 1010
English
0
0
3
1.2K
AB
AB@AsaamBas1T·
@PythonPr The answer is B) because '10' is a string and multiplying a string by 2 repeats the string '10' twice.
English
0
0
0
773
Javier Melo
Javier Melo@Daphito·
@PythonPr C. Error. Python doesn't let you used math between inter and string.
English
0
0
0
167
Neus Lorenzo
Neus Lorenzo@NewsNeus·
@PythonPr B. The fiers line is "a string" of data, not a number. The second line is an integrer, and It operantes x2.
English
0
0
0
67
NovayaZemlya
NovayaZemlya@ZemlyaNova27479·
@PythonPr print(a * 2) =print(a + a) =print("10" + "10") =print("1010") =1010
Magyar
0
0
0
126
💫Allam🇪🇬Mo💫
💫Allam🇪🇬Mo💫@Mo_Allam15·
@PythonPr The result is: B.1010 Reason The variable a has a string value of 10 not a number The variable b has an integer value of 2.
English
0
0
0
116
dien
dien@duappuluhdua·
@PythonPr @grok ini output nya 1010 karna a pake kutip kah? jadi pas minta print outputnya bukan 20? tapi kalo pake nuls(a) gitu baru outputnya 20?
Indonesia
1
0
0
389
Paylaş