Computer Science - Informatics Practices Class XI/XII Python List Solved Test Part 2
Q1. Write the code to create the list of::
- Five vegetables
- Vowels
- First 10 natural
numbers
- Square of first
5 natural numbers.
- Any five names of
your friends
- All the
alphabets of word “Taj Mahal”
- First five
multiples of 6.
Q2. Write a code to convert the string “Practice” into list.
Q3. Write the output of the following:
>>> d =
“a*hj?”
>>> list(d)
Q4. Write the output of the following:
>>>a = “String”
>>>list
(a)
Q5. Write the output of the following:
>>> a =
list ()
>>> a
Q6. What is list() function?
Q7. Write the output of the following:
SOLUTIONS
Ans 1:
b = ['a','e','o','i',u']
c = [1,2,3,4,5,6,7,8,9,10]
d = [1,4,9,16,25]
e = ['amit','anuj','ashu','suman','mridul']
f = ['T','a','j','M','a','h','a','l']
g = [6,12,18,24,30,36]
Ans 2: a = list("Practice")
Ans 3: ['a','*','h','j','?']
Ans 4: ['S','t','r','i','n',g']
Ans 5: []
Ans 6: list() function is used to create empty list and it can also convert certain type of object into list.
Ans 7:
No comments:
Post a Comment