Python List Assignment -1

1. Index value of first element in list is ___
2. Index value of last element in list is ____
3. Write one difference between indexing and slicing
4. The syntax of slicing is
List[start : end :step]
Which argument is optional out of start , end and stop
5. Write the output of the following
b= ‘PythonProgramming’
a = list(a)
6. Write code to make copy of the following list using copy() method
A = [1,34,56,76]
7. What is the difference between pop(), remove() ? Explain with some suitable example
8. How append() method is different with Index() ? Explain with some suitable example

1. Write a program to create list of the following (take input from the user)
a) Name of any five students
b) Five integer numbers
c) Five float numbers
d) Five alphabets
e) Name of five colors
2. Write a program in python to read 10 numbers from the keyboard. Add the number in a list if the entered number is ODD
Input : 1,2,3,4,5,6,7,8,9,10
List1 = [1,3,5,7,9]
3. Write a program in python to find out the largest number from a given list of number without using built in max() function.
4. Write a program in Python to find out the second largest number from a given list of number.
5. Write a program in find out the sum of all the numbers in this list
List1 = [1,2,3,4,’ramji’,67.5,10,’anil’]
Sum = 87.5
6. Write the role of reverse() function in list.
7. reverse() function create new list. (T/F)
8. What type of error return by index() function,if element is not present in list?
9. len() function returns the ______ of the list.
10. By default sort() function arrange the element in ……………………………. Order (increasing/decreasing )
11. What do you mean by nested list. Give one example of nested list.
12. Write code to arrange elements of following list in increasing order.
List1 =[34,3,23,56,6,3,6,89,5,34,78,89]
13. Explain the following functions in reference to list with example
a. Pop()
b. Del
c. Remove()
d. Clear()
e. Count()
14. Name a function/statement which can delete more than one element from the list.
15. Write a program to delete/remove all the odd numbers from the list.
16. Write a program to delete/remove all the negative elements from the list.
17. Write a program to delete/remove all the numbers less than 10 from the list.

Print Friendly, PDF & Email

Related Posts

If you like CBSEToaday and would like to contribute, you can also write an article using submit article or mail your article to See your article appearing on the main page and help other students/teachers.