Skip to content
Y
yTube.SITE v8.0.4
media / worlds / tools / internet oddities
YouTube / video information

Python List Assignment Explained: Why Does b[1] Print 20? πŸ€” #python #pythonquiz

Video information, playback and saved actions.

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
Β Β Β Β Β Β 
Videos related to "Python List Assignment Explained: Why Does b[1] Print 20? πŸ€” #python #pythonquiz"