Python Quiz: What is the Output? x = [ 5 ] print ( x * 3 )
21% [15]
45% [5, 5, 5]
21% 15
14% Error
2,212 votes • Final results

Oct 3, 2026 · 3:57 PM UTC

12
12
88
22,338
Sort replies: Relevant Recent Liked
Replying to @PythonPr
I stand with the majority to choose A
945
Replying to @PythonPr
[5, 5, 5]. The string will repeat. 😎
910
Replying to @PythonPr
[5, 5, 5] In Python, multiplying a list by 3 repeats the list three times. It does not multiply each element by 3
1
6
1,117
Replying to @PythonPr
"x * 3" duplicates the list([5]) three times, hence [5,5,5].
5
940
Replying to @PythonPr
555
1
693
Replying to @PythonPr
Is it the [] that makes python treat it as a set and not a value
142
Replying to @PythonPr
the asterisk operator doesn just repeat the value, it creates a new list object with three references to the same integer 5, which is why the memory footprint stays small until you mutate the inner elements
654
Replying to @PythonPr
تبارك الله عليك، سؤال زوين! الجواب هو [5, 5, 5] ياك؟
22
Replying to @PythonPr
If you try same thing for numpy array. [15] will be answer. import numpy as np x = np.array([5]) print(x * 3)
229
Replying to @PythonPr
[5, 5, 5]
Multiplying a list by an integer repeats the list
x * 3 joins three copies of x into a new list
9
621