0% found this document useful (0 votes)
8 views2 pages

Python Programming Assignment 4

This document contains an assignment on Python programming. It includes theory questions about list methods like pop() and reverse(), dictionary initialization, list comprehensions, recursion limits, and graph representations. Programming questions involve using list comprehensions to filter even integers from a list, find common elements between two lists, create a matrix, and implement graph algorithms. It also includes an optional question to check if a sentence is a pangram.

Uploaded by

vidushi1121
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Python Programming Assignment 4

This document contains an assignment on Python programming. It includes theory questions about list methods like pop() and reverse(), dictionary initialization, list comprehensions, recursion limits, and graph representations. Programming questions involve using list comprehensions to filter even integers from a list, find common elements between two lists, create a matrix, and implement graph algorithms. It also includes an optional question to check if a sentence is a pangram.

Uploaded by

vidushi1121
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ES

102:
PYTHON
PROGRAMMING

ASSIGNMENT4

THEORYQUESTIONS:
1. Statethedifferencebetween:
a. [Link]()anda[:1]
b. [Link]()anda[::1]
Whereaisalist.
2. Givedifferentwaysofinitialisingadictionary
3. Explaintheutilityands yntaxoflistc omprehension
4. Whatdoyouunderstandbyimperativeprogramming?
5. Whatisrecursionlimitandexplainwithreferencetos tackdepth?
6. Whatistheutilityofs trip()whileacceptinginput?
7. Representthefollowinggraphsasedgelist,adjacencylistandadjacencym atrix
representationsinPython
a.

b.


c.

PROGRAMMINGQUESTIONS:
1. Writeaprogramtoacceptalistofintegersasinputfromtheuserandprintanewlist
[Link] omprehension.
2. Writeaprogramtoaccepttwolistsandc reateanewlistwhichc ontainsthe
elementsc [Link] omprehensionstoachievethes ame.
3. Uselistc omprehensiontoc reateam atrixass hownbelow:
1####
#1###
##1##
###1#
####1
4. Implementhisaabtoworkwithadjacencym atriximplementationofgraph.
5. ImplementtheAPIforadjacencym atriximplementations othatthehisaabalgorithm
[Link] hangeanythinginit.
6. Writeaprogramdefiningafunctions um_digits()whichreturnsthes umofdigitsina
[Link] um_digits()asarecursivefunction.

OPTIONALQUESTIONF ORPRACTISE:
APangramChecker:
Apangramisas entencethatusesallalphabetsofEnglishlanguageatleastonce.W ritea
programtoc heckifthegiveninputs entenceisapangram.
Hint:Youc anuseadictionarytoc ountoccurrenceofthec haracters.

You might also like