Question: 1) List[ ] build-in data structure is the most commonly used. There are multiple ways to iterate thru a given list[....]. For this exercise, we
1) List[ ] build-in data structure is the most commonly used. There are multiple ways to iterate thru a given list[....]. For this exercise, we will focus on using - Standard for loop with the list [ 1, 3, 5, 7, 8] - for loop with range( size?) - while loop - list comprehensive. For this exercise, write a function for each of the above methods, and call them from your program. lst1 = [ 1, 3, 5, 7, 8] Result:
2) Dealing with a nested list; list1 = [[10, 20, [300, 400, [5000, 6000], 500], 30, 40] a. Display list1 b. Display the items in list1 one by one. (using a for loop) c. Display the item in [2] d. Display the item in [2][2] e. Add 7000 to after item 6000 and display the new list f. Create a new list that flattens the first nested list to: Flat List [10, 20, 300, 400, [5000, 6000, 7000], 500, 30, 40]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
