Computer Science, asked by mayankkhurana51, 6 months ago

Given a nested list extend it with adding sub list ["h", "i", "j"] in a such a way that it will look like the following list

Given List:

list1 = ["a", "b", ["c", ["d", "e", ["f", "g"], "k"], "l"], "m", "n"]

Sub List to be added = ["h", "i", "j"]

Expected output:

['a', 'b', ['c', ['d', 'e', ['f', 'g', 'h', 'i', 'j'], 'k'], 'l'], 'm', 'n']​

Answers

Answered by Gazanfar0726
3

Explanation:

A list object is mutable in Python. Python list is sequences; Each list item is assigned to its position or index. Python list is the most widely used data structure, and a good understanding of list operations is necessary. This Python list exercise aims to help developers to learn and practice list operations to improve understanding of the Python list. All questions are tested on Python 3.

Similar questions