Question: Use list comprehension to do the following. ( a ) Create a list of all the multiples of 9 between 0 and 1 0 0

Use list comprehension to do the following.
(a)Create a list of all the multiples of 9 between 0 and 100.
(b)Given a list L1 of positive integers, create a new list L2 which replaces even numbers with a 1 and odd numbers with a 0. For example, if L1=[1,2,3,4,5], then L2=[0,1,0,1,0,1].
(c)A list which examines each letter in the string hamilton and prints vowel if the letter is a vowel (a,e,i,o,u) or consonant otherwise.
In each part, select the pieces of code you need to include inside the square brackets [] and enter them into the answer box in the correct order to obtain the desired list. Note that each line may be used more than once, or not at all. So a typical answer might look something like 2,4,6,1,3,7.
##(a) L=[] print(L) ##(b) L1=[1,2,3,3,3,4] L2=[] print(L2) ## lines for (a) and (b) in ##(1) range(101) ##(2) i ##(3) i%2!=0 ##(4) i%2==0 ##(5) else ##(6) for ##(7)0 ##(8) if ##(9)1 ##(10) L1 ##(11) i%9==0 ##(12) ##(c) L=[] print(L) ## lines to include for (c) "consonant" ##(1) for ##(2) if ##(3) i ##(4) else ##(5) "vowel" ##(6) "hamilton" ##(7) "aeiou" ##(8) not ##(9) in ##(10)

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 Programming Questions!