You are on page 1of 5

SIR SYED UNIVERSITY OF ENGINEERING & TECHNOLOGY

COMPUTER SCIENCE & INFORMATION TECHNOLOGY DEPARTMENT


Fall 2023
Programming Fundamentals (CS-116T)
Assignment # 3
Semester: 1st Batch: 2023F
Announced Date: 18-1-24 Due Date: 25-01-24
Total Marks: 04

NOTE: Copy assignment carries “ZERO” marks.

CLO # Course Learning Outcomes PLO Mapping Bloom’s Taxonomy


(CLOs)
Identify the output and errors (logical PLO_3 C3
CLO 3 and syntactical) of different programs. (Problem Analysis) (Applying)

Q.1. Write a Python program that takes a list of numbers as input and creates a new list of tuples. Each
tuple in the new list should contain a number from the input list and its square. Finally, print the
resulting list of tuples."
Sample run:
Input:
List = [2,4,5,1]
Output:
New List = [(2, 4), (4, 16), (5, 25), (1, 1)]
Code:

Output:

Q.2. Write a Python program that make a dictionary called cities. Use the names of three cities as keys
in your dictionary. Create a dictionary of information about each city and include the country that
the city is in, its approximate population, and one fact about that city. The keys for each city’s
dictionary should be something like country, population, and fact. Print the name of each city and
all of the information you have stored about it.
Sample Run:
Santiago is in Chile.
It has a population of about 6158080.
The Andes mountains are nearby.

Kathmandu is in Nepal.
It has a population of about 1003285.
The Himilaya mountains are nearby.

Talkeetna is in Alaska.
It has a population of about 876.
The Alaska Range mountains are nearby.
Code:
Output:

Q.3. Write down the python code and import datetime module and display current date and time.
Code:

Output:

Q.4. The str class has many useful methods. Some are as follows. Write down the codes to apply listed
methods and display the outputs:
isalnum( ):

Output:

isalpha( ):

Output:

isdigit( ):

Output:

isdentifier( ):
Output:

islower ( ):

Output:

isupper ( ):

Output:

isspace ( ):

Output:

You might also like