Python List Assignment Explained: Why Does b[1] Print 20? π€ #python #pythonquiz
Description: β
Correct Answer: A) 20
Explanation:
When we write `b = a`, both variables refer to the original list `[10, 20, 30]`.
Later, when `a = [40, 50]` executes, Python makes `a` refer to a new list. It does not change the original list referenced by `b`.
Therefore, `b` still contains `[10, 20, 30]`.
`print(b[1])` gives 20.
π Concepts covered:
- List assignment in Python
- List references
- Python variables
- Mutable objects in Python
- Python list operations
Improve your Python basics and coding logic with Code With Patel. Follow for more Python programming concepts, tricky coding questions, and Python interview preparation.
#python #pythonforbeginners #pythonbasics #pythonprogramming #pythonlist #pythonquiz #learnpython #codingquestions #pythoninterview #codewithpatelΒ Close description
Explanation:
When we write `b = a`, both variables refer to the original list `[10, 20, 30]`.
Later, when `a = [40, 50]` executes, Python makes `a` refer to a new list. It does not change the original list referenced by `b`.
Therefore, `b` still contains `[10, 20, 30]`.
`print(b[1])` gives 20.
π Concepts covered:
- List assignment in Python
- List references
- Python variables
- Mutable objects in Python
- Python list operations
Improve your Python basics and coding logic with Code With Patel. Follow for more Python programming concepts, tricky coding questions, and Python interview preparation.
#python #pythonforbeginners #pythonbasics #pythonprogramming #pythonlist #pythonquiz #learnpython #codingquestions #pythoninterview #codewithpatelΒ Close description
![Python List Assignment Explained: Why Does b[1] Print 20? π€ #python #pythonquiz](https://i.ytimg.com/vi/6EgoTgMpQoI/mqdefault.jpg)



