PT-2 Class-Xi-Cs
PT-2 Class-Xi-Cs
a=(1, 2, 3, 2, 3, 4, 5)
print(min(a) + max(a) + a.count(2))
b. (1)
a. 13
b. 6
c. 8
d. Error
What will be the output of following code:
L=[12,13,14,15,16,17,18,19,20]
2. a. (1)
print (L[1: 6 : 3]
print (L[: : 3])
5. a. a. print(t+(1,)) (1)
b. print(t+(1))
c. print(t+1)
d. print(t+( ))
What will be the output of following:
b. L1=('a','b','c','d') (1)
L2=('A','B','C','D')
print(L1==L2)
What will be the output of following:
t1=(11,22,'abc','xyz')
a,b,c,d=t1
6. a=a+2 (2)
b=b+2
c=c*2
d=d*2
print(a,b,c,d)
Section – B
Each question carries 3 marks
What will be the output of following:
7. a. (1)
virus=dict(zip(('name','var','wave'), ('CORONA','delta',2)))
print(virus)
What will be the output of following:
teacher={'name':'MMM','desig':'PGT'}
b. (1)
newlist=teacher.items()
print(newlist)
c. What will be the output of the following list operations: (1)
m = [15,10,20]
m.extend([5,30])
print(m.index(5))
print(m.pop(3))
m.insert(3,25)
print(len(m))
For Example:
If the sample Content of the list is as follows:
8. (3)
N=[12, 13, 34, 56, 21, 79, 98, 22, 35, 38]
OR
10. (3)
OR
t2=("sun","mon","tue","wed","thru","fri")
b. (2)
for i in range (-6,0,2):
print(t2[i])
OR
L1=[11,12,13,14,15,14,12,11)
b. L2=[] (2)
for i in L1
IF i not in L2:
L2.append(i)
print.L2
14 What will be the output of the following Dictionary operations? (4)
d = {100:5,150:10,200:20}
print(d.pop(200))
d.update({100:30})
print(d.get(100))
d[300]=40
print(d.popitem())
print(max(d))
print(sorted(d))
OR
a.Write a python program that increases the values by 10 for all
keys of a dictionary that are even numbered. (2)
Eg: D={100:10, 133:20.400:40} Should result is D as {100:20,
133:20.400:50}
****************************************