Question: write it in Python 1. Filter only negative and zero in the list using list comprehension - numbers =[4,3,2,1,0,3,6,9,12] 2. Flatten the following list of
write it in Python
1. Filter only negative and zero in the list using list comprehension - numbers =[4,3,2,1,0,3,6,9,12] 2. Flatten the following list of lists of lists to a one dimensional list : - "i py list_of lists =[[[1,2,3]],[[4,5,6]],[[7,8,9]]] output: [1,2,3,4,5,6,7,8,9] . 3. Using list comprehension create the following list of tuples: [(0,1,0,0,0,0,0), (1,1,1,1,1,1,1), (2,1,2,4,8,16,32), (3,1,3,9,27,81,243), (4,1,4,16,64,256,1024), (5,1,5,25,125,625,3125), (6,1,6,36,216,1296,7776), (7,1,7,49,343,2401,16807), (8,1,8,64,512,4096,32768), (9,1,9,81,729,6561,59049), (10,1,10,100,1000,10000,100000)] 4. Flatten the following list to a new list: - countries =[[(INDIA, MUMBAI') ],[(CHINA, SHANGHAI')], [('FINLAND', 'TAMPERE')] output: [['INDIA', 'IN', 'MUMBAI'], ['CHINA', 'CH', 'SHANGHAI'], ['FIHLAND', 'FI', 'TAMPERE']] 5. Change the following list to a list of dictionaries: - countries =[[(India, 'Mumbai') ],[(China, 'Shanghai')], [('Finland', 'Tampere'). output
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
