Let’s go step by step:
[1, 2] * 2 means the list [1, 2] is repeated twice.
-
So a becomes [1, 2, 1, 2].
a[1] refers to the element at index 1 (the second element), which is 2.
-
We change it to 3.
-
Now a is [1, 3, 1, 2].
-
Prints:
Python Coding July 28, 2025 Python Quiz No comments
Let’s go step by step:
a = [1, 2] * 2
[1, 2] * 2 means the list [1, 2] is repeated twice.
So a becomes [1, 2, 1, 2].
a[1] = 3
a[1] refers to the element at index 1 (the second element), which is 2.
We change it to 3.
Now a is [1, 3, 1, 2].
print(a)
Prints:
[1, 3, 1, 2]Free Books Python Programming for Beginnershttps://t.co/uzyTwE2B9O
— Python Coding (@clcoding) September 11, 2023
Top 10 Python Data Science book
— Python Coding (@clcoding) July 9, 2023
๐งต:
Top 4 free Mathematics course for Data Science ! pic.twitter.com/s5qYPLm2lY
— Python Coding (@clcoding) April 26, 2024
Web Development using Python
— Python Coding (@clcoding) December 2, 2023
๐งต:
0 Comments:
Post a Comment