Professional Documents
Culture Documents
2 (i)
data =['p', 'r', 'o', 'b', 'l', 'e', 'm']
data[2:3] =[]
print(data)
#['p', 'r', 'b', 'l', 'e', 'm']
data[2:5]=[]
print(data)
Output
['p', 'r', 'b', 'l', 'e', 'm']
['p', 'r', 'm']
(ii)
a = [1, 2, 3, 4, 5, 6, 7, 8, 9]
b = a.pop(5) #6
c = a.pop() #9
d = a.pop(-1) #8
print(b)
print(c)
print(d)
print(a)
Output
6
9
8
[1, 2, 3, 4, 5, 7]
3 fruit={}
L1 =['apple','banana','apple','orange']
for index in L1:
if index in fruit:
fruit[index] += 1
else:
fruit[index]=1
print(len(fruit))
print(fruit)
Output
3
{'apple': 2, 'banana': 1, 'orange': 1}
T1 = (1, 2, 3, 4, 5, 6, 7, 8)
print(T1)
print(T1 * 2)
print(T1 + T1)
print(len(T1) * 2)
Output
(1, 2, 3, 4, 5, 6, 7, 8)
(1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8)
(1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8)
16
It is the record or data of a person that exists on the Internet as a result of their
online activity. Examples of digital footprints are login records, posting on social
media or messages on chat apps, visiting websites. There are two types of
digital footprint:
Similarity - both are form of cyber crime which tricks user to reveal their
sensitive personal information
7 Error
text="abracadbra"
counts={}
for word in text:
counts[word] =counts[word] +1
Correct
text="abracadbra"
counts={}
for word in text:
counts[word] =1
(ii)
mydict={}
mydict[(1,2,4)]=8
mydict[[4,2,1]]=10
print(mydict)
mydict={}
mydict[(1,2,4)]=8
mydict[(4,2,1)]=10
print(mydict)
9 import random
PICK=random.randint (1,3) # CITY= ["DELHI", "MUMBAI", "CHENNAI",
"KOLKATA"]
for I in CITY: #Delhi
for J in range (0, PICK): #[0- (1-3)] [0,0-1, 0-2]
print (I, end = "") #
print ()
Correct option
(i) & (iii)
minimum value =1 maximum value =3
10 It refers to any kind of work or creation produced with the help of intellect and
creativity. Examples: books, movies, paintings, logo , music, videos. To protect
the IPR, there are three common ways - copyright, patents, trademark
Output
enter list [2,3,-4,5,6,-7,8,9,-1]
[2, 3, -4, 5, 6, -7, 8, 9, -1]
[2, 3, 5, 6, 8, 9]
[-4, -7, -1]
Output
enter number of terms 20
(0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584,
4181)
Output
enter list[2,3,4,5,2,4,5,6,7,8]
[3, 6, 7, 8]
[2, 4, 5]