Computer Science - Informatics Practices Class XI/XII Python List Solved Test Part 2

 

Computer Science - Informatics Practices Class XI/XII Python List Solved Test  Part 2

Q1. Write the code to create the list of::

  1. Five vegetables
  2. Vowels
  3. First 10 natural numbers
  4. Square of first 5 natural numbers.
  5. Any five names of your friends
  6. All the alphabets of word “Taj Mahal”
  7. 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

Most Recently Published

File Handling Test 6

 File Handling Test 6 Q1 . Do we need to use the close() function when we use 'with' statement to open a file? Q2. Which mode you wi...

CS - IP Assignment/Worksheet