INSTITUTE OF TECHNOLOGY & MANAGEMENT
Integrated Technical Campus: Engineering, Pharmacy & Management
Approved by AICTE, Pharmacy Council of India, New Delhi & Affiliated to Dr. APJAKTU, Lucknow
AL-1, Sector - 7, GIDA, Gorakhpur - 273209 (UP)
Assignment -2
Issue Date: 04-06-24 Submit Date: 10-06-24
Section: A
[Link]
Q No.1 Evaluate
a. 2**6//8%2
b. 9**2//5-3
c. 10+6-2%3+7-2
Q No.2 Implement following functions using list
a. len()
b. min()
c. max()
Q No.3 Write a program to take an empty list and add ten elements in list by using for loop.
Q No.4 Given a number n we wish to do following :
a. if n is positive – print n*n , set flag to true
b. if n is negative – print n*n*n , set a flag to true
c. if n is 0 – do nothing .
Section: B
[Link]
Q No.5 Write a program that swap the values of variables a and b. you are not allowed to use a
third variable. You are not allowed to perform arithmetic on a and b.
Q No.6 A five digit number is entered through keyword. Writ a program to obtain the reversed
number and to determine whether the original and reverse numbers are equal or not.
Q No.7 Write a program to print all prime number between 1 to 100
Q No.8 Write a program to implement a stack data structure. Stack is last in first out list in which
addition and deletion take place at the same end.
Section: C
[Link]
Q No.9 Write a program that prints a number, its square and its cube repeatedly range(a,n)
Q No.10 Write a program to find out the largest number among three numbers
Q No.11 Write a python program to perform following operations:
a) pack first 10 multiple of 10 into tuple
b) Unpack the tuple into 10 variables.
c) Unpack the tuple such that first value store in x , last value store in y and all
values in between store in a single variable.
Q No.12 Tuple (‘F’,’I’,’a’,’b’,’e’,’r’,’g’,’a’,’s’,’t’,’e’,’d’). Write a python program to carry out the
following operation.
a) Add an ! at the end of tuple
b) Convert a tuple to string
c) Check whether ‘r’ exit in the tuple
d) Delete character ‘b’,’b’,’e’,’r’ from the tuple
Q No.13 Write a program to create three dictionaries and concatenate them to create fourth
dictionary.