Revision Tour Worksheet
Revision Tour Worksheet
“Computer Science”[0:6] =
7 “Computer Science”[3:10] =
“Computer Science”[::-1] =
“Computer Science”[-8:]=
Ans.
Ans.
Raj was working on application where he wanted to divide the two
number (A and B) , he has written the expression as C = A/B, on
execution he entered 30 and 7 and expected answer was 4 i.e. only
10 integer part not in decimal, but the answer was 4.285 approx, help
Raj to correct his expression and achieving the desired output.
Correct Expression :
Ans.
Page :1
12 Write 2 advantages and disadvantages of Python programming language
1)
Ans.
Ans.
Ans.
Output of :
(i) True + True =
16 (ii) 100 + False =
(iii) -1 + True =
(iv) bool(-1 + True) =
Ans.
Output of
(i) 2 * 7 =
(ii) 2 ** 7 =
17 (iii) 2**2**3 =
(iv) 17 % 20 =
(v) not(20>6) or (19>7) and (20==20) =
Ans.
Page :2
Output of :
a,b,c = 20,40,60
18 b+=10
c+=b
print(a,b,c)
Ans.
19 Write a program to enter 2 number and find sum and product
Ans.
Ans.
Ans.
Page :3
Consider a list:
MyFamily = [“Father”,”Mother”,”Brother”,”Sister”,”Jacky”]
Ans.
Consider a Tuple:
Record = (10,20,30,40)
Raj wants to add new item 50 to tuple, and he has written
23 expression as
Record = Record + 50, but the statement is giving an error, Help
Raj in writing correct expression.
Correct Expression :
Ans.
24 What is the difference between List and Tuple?
Ans.
25 What is the difference between List and String?
Ans.
Ans.
Consider a Dictionary
27
Employee = {„Empno‟:1,‟Name‟:‟Snehil‟,‟Salary‟:80000}
Page :4
Write statements:
(i) to print employee name
(ii) to update the salary from 80000 to 90000
(iii) to get all the values only from the dictionary
(i)
Ans.
Num = 100
Isok = False
28 print(type(Num)) =
print(type(Isok)) =
Page :5
Rewrite the following code in python after removing all syntax
error(s). Underline each correction done in the code:
32
for Name in [Ramesh,Suraj,Priya]
IF Name[0]='S':
print(Name)
Ans.
Ans.
Page :6
Ans.
Write a program to enter any number and check it is divisible by 7
37
or not
Ans.
Ans.
(ii)
for i in range(1,10):
if i % 4 == 0:
Page :7
continue
print(i)
Ans.
Ans.
Page :8
range(20) (ii) range(0,21) (iii) range(21) (iv) range(0,20)
Ans.
Which is the correct form of declaration of dictionary?
(i) Day={1:‟monday‟,2:‟tuesday‟,3:‟wednesday‟}
44 (ii) Day=(1;‟monday‟,2;‟tuesday‟,3;‟wednesday‟)
(iii) Day=[1:‟monday‟,2:‟tuesday‟,3:‟wednesday‟]
(iv) Day={1‟monday‟,2‟tuesday‟,3‟wednesday‟]
x="abAbcAba"
for w in x:
if w=="a":
48 print("*")
else:
print(w)
Ans.
Give Output
50 colors=["violet", "indigo", "blue", "green", "yellow", "orange", "red"]
del colors[4]
Page :9
colors.remove("blue")
p=colors.pop(3)
print(p, colors)
A=10
B=10
55 print( A == B) = ?
print(id(A) == id(B) = ?
print(A is B) = ?
Page :10