0% found this document useful (0 votes)
210 views5 pages

Experiment #2 (B) : Name: - Usman Rasheed Registration No: - 38019

Usman Rasheed performed several Python exercises using lambda functions and file input/output. He wrote programs to (1) square and cube numbers in a list, (2) check if a string starts with a given character, and (3) extract the year, month, date and time from a string. Additionally, he created programs to (1) accept city data from keyboard input and store it in a file and (2) append a message to an existing student data file.

Uploaded by

Syed rohan
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
0% found this document useful (0 votes)
210 views5 pages

Experiment #2 (B) : Name: - Usman Rasheed Registration No: - 38019

Usman Rasheed performed several Python exercises using lambda functions and file input/output. He wrote programs to (1) square and cube numbers in a list, (2) check if a string starts with a given character, and (3) extract the year, month, date and time from a string. Additionally, he created programs to (1) accept city data from keyboard input and store it in a file and (2) append a message to an existing student data file.

Uploaded by

Syed rohan
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/ 5

EXPERIMENT #2 (B)

INTRODUCTION
Name: - Usman Rasheed
Registration No: - 38019

LAB TASKS

Exercise 1
Perform the given operations
I. a Python program to square and cube every number in a given list of integers using
Lambda.
Answer:
II. a Python program to find if a given string starts with a given character using Lambda.
Answer:

III.a Python program to extract year, month, date and time using Lambda.
Answer:
Exercise 2
I. You have collected information about cities in your province. You decide to store
each city’s
name, population, and mayor in a file. Write a python program to accept the data
for a number of
cities from the keyboard and store the data in a file in the order in which they’re
entered.
Answer:
II. Write a python program to create a data file student.txt and append the message
“Now we are AI students”s
Answer:

You might also like