forked from tdwojak/Python2017
20 lines
496 B
Python
20 lines
496 B
Python
def f(typ):
|
|
return id(typ)
|
|
|
|
def tests():
|
|
lista=[1,2,3]
|
|
napis='1234'
|
|
float=1.42
|
|
id_table_back = [f(lista),f(napis),f(float)]
|
|
typ = ['lista','napis','liczba zmiennoprzecinkowa']
|
|
lista.append(5)
|
|
napis='1234'+'5'
|
|
float*=2
|
|
id_table_now = [f(lista), f(napis), f(float)]
|
|
|
|
for i in range(len(id_table_back)):
|
|
if id_table_back[i]==id_table_now[i]:
|
|
print(typ[i],'jest mutable')
|
|
else:
|
|
print(typ[i],'jest immutable')
|
|
tests() |