Data Structure Lab 1: Python List Operations - Prof. Khan, Cheat Sheet of Physics

Information about various python list operations as presented in a lab assignment submitted by waleed abdullah. The assignment includes tasks such as creating a list, finding the largest and smallest numbers, counting strings with same first and last characters, and generating a list of square numbers. Additionally, there is a task to write a program for maintaining a shopping list.

Typology: Cheat Sheet

2018/2019

Uploaded on 09/26/2021

walied-hayat-1
walied-hayat-1 🇵🇰

1 document

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Name:Waleed Abdullah(18257)
Section:CB
Subject: Data Structure
Submitted To:Sir shazeb
Date:21 sep 2021
Lab 1: Lists
Task 1: Execute the following Python program to sum all the items in a list.
def sum_list(items):
pf3
pf4

Partial preview of the text

Download Data Structure Lab 1: Python List Operations - Prof. Khan and more Cheat Sheet Physics in PDF only on Docsity!

Name:Waleed Abdullah(18257) Section:CB Subject: Data Structure Submitted To:Sir shazeb Date:21 sep 2021 Lab 1: Lists Task 1: Execute the following Python program to sum all the items in a list. def sum_list(items):

Task 2: Write a Python function for each of the following operations on list? (2+2+2+2+2)

  1. to create a list for data elements having values 2, 6, 7, 8, and 1. Display all data elements on screen.
  2. to find and print the largest and smallest numbers from a given list.
  1. Write a program that will keep track of items for a shopping list. The program should keep asking for new items until nothing is entered (no input followed by enter/return key). The program should then display the full shopping list.