ASSIGNMENT 2
Subject: Python Application Program
Subject Code: 15CS664
SEM: VI DIV: B
Type: Open book Written Assignment
Dead Line: Before April 25th 2019
Assignment Questions:
1. Define and Compare List, Dictionary and Tuples. Write the
answer in the following format:
List
|
Dictionary
|
Tuple
|
|
Definition
|
|||
Empty
|
|||
Single element
|
|||
Five Elements
|
|||
Example for Accessing
|
2
Explain with examples the different
ways to create a list. Why lists are called Mutable. Discuss the following List
operations and functions with examples: Traversing , Slicing , +
(concatenation) , * (Repetition) ,
append , extend , sort , remove , delete , len , sum, min , max , split and
join .
3 Differentiate between Key and value
of the Dictionary element. Mention the properties of Key . Discuss the following Dictionary operations
and functions with examples: Accessing , Traversing using loop , Updating
and Deleting
4 Compare Tuple with list. Discuss the
following tuple operations and functions with examples: Accessing , Updating , Deleting , Traversing (Iteration)
, Comparing , len ,(in) membership ,
+ (concatenation) , *
(Repetition) and DSU (Decorate , Sort and Undecorate ) pattern
5 Discuss the Tuple Assignment with
example . Write a Python program to input two integers a and b
, and swap those numbers . Print both input and swapped numbers
6 With example program illustrate how
the Dictionary can be used to count the occurrence of words in a file.
Faculty In charge