Posted on Leave a comment

Python list ut

1 mark questions

  1. How many types of built-in types of sequences in Python.
  2. Write the output of the given Python code.

!/user/bin/python

list1 = [‘physics’, ‘chemistry’, 1997, 2000];
list2 = [1,2,3,4,5,6, 7];
print “list1[0]”, list1[0]

  1. How can we remove list element ?
  2. Which function is use for returning the lowest index in list that obj appears.

5. Is list.reverse() method return a value?

3 mark questions

1.How to slice lists in Python?
2.Define list in python. explain list syntax
3.How are lists different from strings when both are sequences ?
4.Define a function overlapping ( ) that takes two lists and returns True if they have at least one member in common, False otherwise.

5.What is string in Python and how can we access values in list.

5 mark quesions

1.Start with the list[8,9,10]. Do the following using list functions

(a) Set the second entry (index 1) to 17
(b) Add 4, 5 and 6 to the end of the list.
(c) Remove the first entry from the list.
(d) Sort the list.
(e) Double the list.
(f) Insert 25 at index 3

  1. WAP to count frequency of a given element in a list of numbers.
  2. WAP to add,subtract,mutiply and divide 2 lists . based on the user option perform the above operations.

Leave a Reply