0% found this document useful (0 votes)
49 views

Python Program Lab Assignmnet 04

The document provides instructions for an assignment on performing various operations on list data structures in Python. Students are asked to write code to create and manipulate lists by accessing elements, slicing, reversing order, sorting, merging, and more. They are also asked to write functions to generate acronyms from phrases and abbreviations for months based on numbers. The objectives are to learn and implement lists while practicing common list operations and functions.

Uploaded by

ISKCON ICON
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views

Python Program Lab Assignmnet 04

The document provides instructions for an assignment on performing various operations on list data structures in Python. Students are asked to write code to create and manipulate lists by accessing elements, slicing, reversing order, sorting, merging, and more. They are also asked to write functions to generate acronyms from phrases and abbreviations for months based on numbers. The objectives are to learn and implement lists while practicing common list operations and functions.

Uploaded by

ISKCON ICON
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

School of Computer Engineering and Technology

ASSIGNMENT NO: 4

Problem Statement:
Different Operations on List Data Structure.

Aim:
Write a python program to create, append and remove etc. operation on list.

Objectives:
To learn and implement List data structure.

Theory:
1. Write about Different data structures in python.
2. Write down about different operations performed on List

Platform: Windows/Ubuntu-Python Editor(jupyter notebook)


Algorithm/Pseudo code: Students should write algorithm/Pseudo code for the given
problem statement.

Input: Different list and operations

Output: Display Different operations performed on list.

Exercises on list
Perform following exercises and upload a single file of jupyter notebook containing
all exercise’s code and respective outputs

1) Define a list called list_1 with four integer members, and find the output of the
following
1) Access the first three elements from list_1 using forward indices: list_1[0:3] 
2) Access the last element from list_1 using the len function: list_1[len(list_1) - 1]
3) Access the last two elements from list_1 by slicing: list_1[-2:] 
4) Access the first two elements using backward indices list_1[:-2] 
5) Reverse the elements in the string: list_1[::-1]
1
2) Accept 20 values from user and save it in list. Perform following operations on it
a) count similar elements of list and print their index value   
b) count even and odd values of list 
c) count positive and negative values of list.
3) Accept 10 values from user and save it in list. Perform following operations on it 
a) Sort list in ascending order using sorted() function and display sorted list
b) sort list in descending order using sort() function
c) display length of list
4) Accept two lists from user and merge them using + in a single list
5) An acronym is a word formed by taking the first letters of the words in a phrase and
making a word from them. For example, RAM is an acronym for “random access
memory.” Write a program that allows the user to type in a phrase and then outputs the
acronym for that phrase. Note: the acronym should be all uppercase, even if the words in
the phrase are not capitalized.
6) Write a program to print the abbreviation of a month, given its number
Conclusion:

Studied python List Data Structure.

FAQs:

1. Is a list mutable? Explain with Example.


2. What is the difference between append and extend?
3. Do python lists store values or pointers?
4. What is the difference between “remove” and “pop”?

You might also like