100% found this document useful (1 vote)
27 views2 pages

Lists: Exercises For Observation

The document lists exercises involving lists: 1. Read a list of numbers and calculate sum, sum of evens, sum of odds, max, min. 2. Merge two sorted lists without built-ins. 3. Return a new list with only unique elements from an input list. 4. Find the most repeated element (mode) in a list. 5. Create a student list with sid and sname, display a menu to add, insert, display, find by sid/sname, delete, and exit.

Uploaded by

Kalyani Dasari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
27 views2 pages

Lists: Exercises For Observation

The document lists exercises involving lists: 1. Read a list of numbers and calculate sum, sum of evens, sum of odds, max, min. 2. Merge two sorted lists without built-ins. 3. Return a new list with only unique elements from an input list. 4. Find the most repeated element (mode) in a list. 5. Create a student list with sid and sname, display a menu to add, insert, display, find by sid/sname, delete, and exit.

Uploaded by

Kalyani Dasari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

Lists
Exercises for Observation:

1. Write a program to read a list of N numbers and find the sum, sum of even numbers, a sum of odd
numbers, biggest and smallest number in the given list?

2. Write a function that takes in two sorted lists and merges them. The lists may not be of the same
length and one or both may be empty. [Note: Don’t use any Python built-in methods or functions]

3. Write a program to read a list of elements from user and returns a new list with only the unique
elements from the original.

4. Define a function, which takes a list variable as a parameter and find mode (most repeated value) in
the given list?

5. Create a list which contains a list of sid and sname([[sid,sname]]). Display the following menu and
perform the operations until the user wants to be quit from the program.

        MENU

    1. Add student details(append)

    2. Add student details(insert)

    3. Display list

    4. Display student name for given sid

    5. Display student id for given sname

    6. Delete student details

    7. Exit
Exercises for Record:

1. Write a function called remove_duplicates and pass one list as a parameter and returns a new list
with only the unique elements from the original.

2. Create a list which contains a list of sid and sname([[sid,sname]]). Display the following menu and
perform the operations until the user wants to be quit from the program.

        MENU

    1. Add student details(append)

    2. Add student details(insert)

    3. Display list

    4. Display student name for given sid

    5. Display student id for given sname

    6. Delete student details

    7. Exit

You might also like