Python Quiz 19: List Quiz | Can You Guess the Output of this Python Code? | Python For Beginners

preview_player
Показать описание
#yasirbhutta @yasirbhutta

The answer is A) [0, 2, 3, 4].

In Python, lists are mutable objects which means that they can be modified after they are created. In this case, we have two variables a and b that reference the same list object [1, 2, 3, 4]. When we assign b = a, we are not creating a new list object but rather creating a new reference to the same list object that a references. Therefore, any changes made to b will also affect a.

When we modify b[0] by setting it to 0, we are also modifying the first element of the list object that a references. Therefore, when we print a after modifying b, we get [0, 2, 3, 4].

If you enjoyed this video, please give it a thumbs up 👍and leave a comment 💬 below. Don't forget to subscribe 🔔to my channel for more Python tutorials like this one.

YouTube Playlists:

You can also follow me on:

Thanks for watching! 🙏**

#codingshorts #coding #pythonprogramming #pythonbasics #codingshortvideo #yasirbhutta #python #codinglife #pythontutorial #pythontutorial #pythontutorial
Рекомендации по теме
Комментарии
Автор

If you enjoyed this video, please give it a thumbs up 👍and leave a comment 💬 below. Don't forget to subscribe 🔔to my channel for more Python tutorials like this one.


YouTube Playlists:



You can also follow me on:


Thanks for watching! 🙏**

yasirbhutta
visit shbcf.ru