Question: In Python (begginer) 1) List[ ] build-in data structure is the most commonly used. There are multiple ways to iterate thru a given list [..].For

In Python (begginer)  In Python (begginer) 1) List[ ] build-in data structure is the
most commonly used. There are multiple ways to iterate thru a given

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. Ist1 =[1,3,5,7,8] Result: for_ i 1,3,5,7,8, for_range 1,3,5,7,8, while_ i 1,3,5,7,8, list comprehension 1,3,5,7,8, 2) Dealing with a nested list; list 1=[[10,20,[300,400, [5000,6000],500],30,40] a. Display list 1 b. Display the items in listl 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] Results: a. the original list [10,20, [ 300,400 , [ 5000,6000],500], 30,40] b. each item of list1: 10 20 [300,400,[5000,6000],500] 30 40 c. list1 [2] is [300,400,[5000,6000],500] d. list 1 [2] [2] is [5000,6000] e. add 7000 to the inner.inner list[2][2] [10,20,[300,400,[5000,6000,7000],500],30,40] f. flatten the 1 st level nested list Flat List [10,20,300,400,[5000,6000,7000],500,30, 40]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!