January 2019
Beginner
318 pages
8h 23m
English
Tuple updating is not possible in Python, as tuples are immutable. But you can create a new tuple with an existing tuple, as shown in the following example:
#!/usr/bin/python3cities = ('Mumbai', 'Bangalore', 'Chennai', 'Pune')numbers = (1,2,3,4,5,6,7)tuple1 = cities + numbersprint(tuple1)Output:('Mumbai', 'Bangalore', 'Chennai', 'Pune', 1, 2, 3, 4, 5, 6, 7)
Read now
Unlock full access