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: • Learning to program with Python 3 (py 3.7)
#python #programming #tutorial
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)
In questa pagina del sito puoi guardare il video online Mutability revisited - Python 3 Programming Tutorial p.8 della durata di ore minuti seconda in buona qualità , che l'utente ha caricato sentdex 01 gennaio 1970, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 113,589 volte e gli è piaciuto 1.7 mille spettatori. Buona visione!