Python nested sequence challange | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Python nested sequence challange

# Nested sequence challange # create a code that allows you to switch the element '1' in the nested sequence 'stuff' to '18'. Use the nested sequence below. stuff = [('verb','1','2','3','4'),('bold','5','6','7','8'), ('legs','9','10','11','12')] Example of what your output should look like: [('verb','18','2','3','4'),('bold','5','6','7','8'), ('legs','9','10','11','12')]

2nd Dec 2017, 5:00 AM
Desiray
2 Answers
2nd Dec 2017, 3:32 PM
Daniel
Daniel - avatar
0
sorry, my clarification was wrong. The whole nested sequence should be printed at the end. hint: This is a tuple within a list and tuples are immutable. your output should look like this: [('verb','18','2','3','4'),('bold','5','6','7','8'), ('legs','9','10','11','12')]
6th Dec 2017, 3:22 AM
Desiray