How to Adding and changing items in a Tuple-Modify nested items of a tuple:

 #how to Adding and changing items in a Tuple

tup = (0, 1, 2, 3, 4, 5)

slist = list(tup)

slist.append(6)

tup = tuple(slist) # converting list back into a tuple

print(tup)  


#Modify nested items of a tuple:

tup = (10, 20, [25, 75, 85])

print(tup)

tup[2][0] = 250

print(tup)

how to Adding and changing items in a Tuple


No comments:

Post a Comment

Latest Post

Don’t Sweat It – Chill with Crompton Air Cooler Deals

 ðŸŒž Don’t Sweat It – Chill with Crompton Air Cooler Deals  More Details : https://www.amazon.in/s?k=laptops+under+70000&crid=29QIFPXQYB3...