Post

Python Developer
Python Developer@Python_Dv·
Comment The Answer ❓📚🤔
Python Developer tweet media
English
21
10
87
11.7K
Sergei Kotov
Sergei Kotov@kotov_dev·
Answer: B) [1, 2, 3, 1, 2, 3] List * int repeats the entire list: › [1,2,3] * 2 = [1,2,3,1,2,3] For beginners: This works not only for lists: › List: [1,2]*2 = [1,2,1,2] › String: "ab"*2 = "abab" › Tuple: (1,2)*2 = (1,2,1,2) But won't work for sets/dicts - they don't support *
English
0
1
14
909
The root of infinity
The root of infinity@parth_hirpara05·
@Python_Dv Ans---> B) [1, 2, 3, 1, 2, 3] In Python, multiplying a list by an integer repeats the list, it does not multiply each element. If it were element-wise multiplication, we’d need something like a loop, list comprehension, or NumPy.
English
0
0
3
522
Kamal Gurjar
Kamal Gurjar@KamalGurjar8·
@Python_Dv Output: B ✅ x * 2 on a Python list repeats the list, it doesn’t multiply each element. Output: [1, 2, 3, 1, 2, 3]
English
0
0
2
1K
Jay
Jay@learnaiwthme·
@Python_Dv Answer: B) ✅ x = [1, 2, 3] is a list. In Python, multiplying a list by an integer repeats the list, it does not multiply elements. So: x * 2 becomes: [1, 2, 3, 1, 2, 3] 👉 Correct answer: B) [1, 2, 3, 1, 2, 3]
English
0
0
2
412
Python Tech
Python Tech@PythonTech43716·
@Python_Dv B is correct answer. Here it will not going to multiply with each number it simply will give sequence repetition.
English
0
0
2
393
Earnest Codes
Earnest Codes@Earnesto037·
@Python_Dv Answer: (b. In Python, multiplying a list by an integer (n) does not perform element-wise multiplication. Instead, it concatenates the list with itself (n) times.  In this specific case, the list (x) is multiplied by 2, which results in the list being
English
1
0
2
585
DocsAllOver
DocsAllOver@docsallover·
@Python_Dv B. List multiplication repeats the list, it doesn’t do element-wise math.
English
0
0
0
10
Paylaş