Mutability revisited - Python 3 Programming Tutorial p.8

Your video will begin in 10
Skip ad (5)
ads, add your ads

Thanks! Share it with your friends!

You disliked this video. Thanks for the feedback!

Added by admin
181 Views
In this part, we're going to revisit the topic of mutable and immutable objects. This concept is masked pretty well in Python, which, like dynamic typing, can be great... or not. It can really bite you one day if you don't have a good understanding of how it works, so let's talk about it.

Playlist: https://www.youtube.com/playlist?list=PLQVvvaa0QuDeAams7fkdcwOGBpGdHpXln

quiz:

x = 1
def test():
x = 2
test()
print(x)


x = 1
def test():
global x
x = 2
test()
print(x)


x = [1]
def test():
x = [2]
test()
print(x)


x = [1]
def test():
global x
x = [2]
test()
print(x)


x = [1]
def test():
x[0] = 2
test()
print(x)
Category
World Tutorials Country A - L World Tutorials Country N - T

Post your comment

Comments

Be the first to comment