mutable numbers | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

mutable numbers

Hello guys, please what are mutable numbers?

28th Jul 2019, 12:23 AM
FAROUK SHITTU
1 Answer
0
Mutable means changeable, so lists and dictionaries are the first objects that come to mind, with regards to python. Basically, you can add to and take from. However, tuples are immutable and cannot be changed, but what about a list object inside a tuple?... A mutable object inside an immutable object? Well, you can update those too. x=[] for each in range(1,11): x.append(each) print(x) y=([],6,7) for each in range(1,6): y[0].append(each) print(y)
28th Jul 2019, 12:31 AM
Steven M
Steven M - avatar