Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 2

Assignment (Lists—without using build in functions)

Practical 1 Write a program to input 10 elements from the user in a list


and print the elements in reverse order
Practical 2 Write a program to input 10 elements from the user in a list
and print the sum of all the elements and print its average also.
Practical 3 Write a program to input 10 elements from the user in a list
and print square of values at all even indexes and cube of values at all odd
indexes.
Practical 4 Write a program to input 10 elements from the user in a list
and print square of all even elements and cube of all odd elements of the
list.
Practical 5 Write a program to input 5 elements in two different lists and
store the sum of elements present in same indexes of both the lists in
respective index of third list. Print the third list.
Practical 6 Write a program to input 10 elements from the user in a list
and perform the following operation:
Multiply the elements of odd indexes by 3 and divide the elements even
indexes by 2
Display the original and modified list.
Practical 7 Write a program to input 10 elements from the user in a list
and perform the following operation:
Increment the value of each element by 10
Display the original and modified lists.
Practical 8 Write a program to input 10 elements from the user in a list
and calculate the number of positive values, number of negative values and
zeros entered by the user in list.
Practical 9 Write a program to input 10 elements from the user in a list
and replace all the occurrences of inputted number to zero if present in list.
Practice Questions
Practical 1 WAP to remove duplicate elements from an inputted list
Practical 2 WAP to print the second largest element from an inputted list
(without using sort() or sorted() functions)
Practical 3 WAP to input 10 numbers in a list and sort the elements of first
half in ascending order and the second half in descending order
Example : if the inputted list is
[45, 3, 89, 12, 92, 34]
Output :
[3, 45, 89 , 92, 34, 12]
Practical 4 WAP to add all the numbers from a heterogeneous list of
elements inputted by the user.
Example : if the inputted list is
[ 12, “abc” , 10, “def”]
Output : Sum of all the numbers inputted in the list is 22
Practical 5 WAP to check whether the inputted list is a palindrome list or
not
Example1 : if the inputted list is
[45, 3, 89, 3, 45]
Output : the list is a palindrome list
Example1 : if the inputted list is
[ 3, 23, 45, 6 ]
Output : the list is not a palindrome list

Practical 6 WAP to input two lists and print the common elements and also
number of common elements inputted.

Practical 7 WAP to remove all the duplicate string elements inputted from
the original list and store it in another list.

Practical 8 WAP to shift all the elements of a list to one right and the last
element to the starting of the list. (without using slicing)
Example : if the inputted list is
[45, 3, 89, 12, 92]
Output : [92, 45, 3, 89, 12]

Practical 9 WAP to generate a frequency table of all the elements with how
many times it is present in the list.
Example : if the inputted list is
[11,21,32,48,0,0,11,21,21,48,21,0,0,21]
Output : element No of times
11 2
21 5
32 1
48 2
0 4

You might also like