W W W. L I B W R L D . B L O G S P O T. C O M
PYTHON
REVISION
TOUR - 1
W W W. L I B W R L D . B L O G S P O T. C O M
1 MARK
W W W. L I B W R L D . B L O G S P O T. C O M
Which of the following is valid arithmetic operator in Python:
(i) // (ii)? (iii) < (iv) and
? Is not a symbol used in python
< is used to check conditions
and is used for boolean
// is used for floor division that’s why the correct answer is //
W W W. L I B W R L D . B L O G S P O T. C O M
Identify the valid arithmetic operator in Python from the following.
a) ? b) < c) ** d) and
It is similar to prevous question and yes the answer you chose is correct it’s
c) **
W W W. L I B W R L D . B L O G S P O T. C O M
Find the invalid identifier from the following
a) 2two b) two2 c)trues d) true_sl
2two starts with 2 which is numeric thus it is invalid identifier.
Others don’t violate any law so they are valid identifier
W W W. L I B W R L D . B L O G S P O T. C O M
Find the invalid identifier from the following
a) MyName b) True c) 2ndName d) My_Name
You should have guessed it after reading the question. Yes, the solution is (c) 2ndName
W W W. L I B W R L D . B L O G S P O T. C O M
Evaluate the expression:
if A=16 and B =15 then A//B is
(a) 0.0 (b) 0 (c ) 1.0 (d) 1
(d) 1 is the correct answer because A//B is floor division in which there is no decim
places and 16 is greater than 15.
W W W. L I B W R L D . B L O G S P O T. C O M
Write the modules that will be required to be imported to execute the following
functions in Python
(i) floor( ) (ii) randint( )
Try it……………………………………….Yes you got it right it’s math
W W W. L I B W R L D . B L O G S P O T. C O M
2 MARK
W W W. L I B W R L D . B L O G S P O T. C O M
Evaluate the following expressions:
(i) not(20>6) or (19>7)and(20==20)
(ii) 17%20
(I) The order of preferances is
NOT > AND > OR
so, check the conditions and solve it
(ii) 17%20 gives 17
Since 17 is smaller than 20. It is default setting of python.
W W W. L I B W R L D . B L O G S P O T. C O M
Rewrite the following code in python after removing all syntax error(s).
Underline each correction done in the code.
30=To
for K in range(0,To)
IF k%4==0:
print (K*4)
Else:
print (K+3)
To=30
for K in range(0,To):
if K%4==0:
print(K*4)
else:
print(K+3)
W W W. L I B W R L D . B L O G S P O T. C O M
What do you understand by the term type conversion? Explain with suitable
example.
Typecasting, or type conversion, is a method of changing an entity from one data
type to another. It is used in computer programming to ensure variables are
correctly processed by a function.
An example of typecasting is converting an integer to a string.
A = “17”
B = int(A)
print(b)
It’s output will be 17. Here we converted “17” string into 17 integer value.
W W W. L I B W R L D . B L O G S P O T. C O M
a) Write the names of any two data types available in Python.
b) Name the Python Library modules which need to be imported to invoke the followin
functions :
i) sqrt() ii) randint()
a) String, Integer, Boolean(any two)
b) math
W W W. L I B W R L D . B L O G S P O T. C O M
Evaluate the following expressions:
a) 14+13%15
b) b) 50 > 6 and 3 > 13 or not 19 > 2
a) The preferences for arithmetic operators is
+,- -- %,//,/* ----**
13%15 will give 13 since 13 is greater than 15 and the sum will be 27
b) It’s solution will be FALSE. Check previous questions for referance.
W W W. L I B W R L D . B L O G S P O T. C O M
Evaluate the following expressions:
a) 6 * 3 + 4**2 // 5 – 8
b) b) 10 > 5 and 7 > 12 or not 18 > 3
a) The steps taken will be in order:
4**2 which will give 16
6*3 which will give 18
16//5 which will give 3
3-8 which will give -5
18+(-5) which will give 13
So the solution is 13.
b) Do it yourself. The solution is FALSE.
W W W. L I B W R L D . B L O G S P O T. C O M
Rewrite the following code in Python after removing all syntax error(s).
Underline each correction done in the code.
V=80
for c in range(0,V)
If c%4=0:
print (c*4)
Elseif c%5==0:
print (c+3)
else:
print(c+10)
V=80
for c in range(0,V) :
if c%4==0:
print (c*4)
elif c%5==0:
print (c+3)
else:
print(c+10)
W W W. L I B W R L D . B L O G S P O T. C O M
Rewrite the following code in Python after removing all syntax error(s).
Underline each correction done in the code.
Value=30
for VAL in range(0,Value)
If val%4==0:
print (VAL*4)
Elseif val%5==0:
print (VAL+3)
else
print(VAL+10)
Try debugging(removing all errors) yourself. It is important to practice..
W W W. L I B W R L D . B L O G S P O T. C O M
Evaluate the following expressions:
a) 5 * 3 + 3**2 % 5 – 8
b) b) 8>5 or 10 > 12 and not 18 > 3
Solve it yourself and comment below to show your participation.
W W W. L I B W R L D . B L O G S P O T. C O M
Rewrite the following code in Python after removing all syntax error(s).
Underline each correction done in the code.
Num=int(“Enter a number”)
for N in range(0,Num)
If n%2=0:
print (n*4)
Elseif n%5==0:
Print (n+3)
else
print(n+10)
Do it yourself and Comment the solution below.
W W W. L I B W R L D . B L O G S P O T. C O M
Rewrite the following code in Python after removing all syntax error(s). Underline
each correction done in the code.
250 = Number
WHILE Number<=1000:
If Number=>750:
print(Number)
Number=Number+100
else
print(Number*2)
Number=Number+50
It is an easy question. I know that after doing the previous questions it must feel
Boring but let’s do it. Comment below your hardwork.

PYTHON REVISION TOUR - 1

  • 1.
    W W W.L I B W R L D . B L O G S P O T. C O M PYTHON REVISION TOUR - 1
  • 2.
    W W W.L I B W R L D . B L O G S P O T. C O M 1 MARK
  • 3.
    W W W.L I B W R L D . B L O G S P O T. C O M Which of the following is valid arithmetic operator in Python: (i) // (ii)? (iii) < (iv) and ? Is not a symbol used in python < is used to check conditions and is used for boolean // is used for floor division that’s why the correct answer is //
  • 4.
    W W W.L I B W R L D . B L O G S P O T. C O M Identify the valid arithmetic operator in Python from the following. a) ? b) < c) ** d) and It is similar to prevous question and yes the answer you chose is correct it’s c) **
  • 5.
    W W W.L I B W R L D . B L O G S P O T. C O M Find the invalid identifier from the following a) 2two b) two2 c)trues d) true_sl 2two starts with 2 which is numeric thus it is invalid identifier. Others don’t violate any law so they are valid identifier
  • 6.
    W W W.L I B W R L D . B L O G S P O T. C O M Find the invalid identifier from the following a) MyName b) True c) 2ndName d) My_Name You should have guessed it after reading the question. Yes, the solution is (c) 2ndName
  • 7.
    W W W.L I B W R L D . B L O G S P O T. C O M Evaluate the expression: if A=16 and B =15 then A//B is (a) 0.0 (b) 0 (c ) 1.0 (d) 1 (d) 1 is the correct answer because A//B is floor division in which there is no decim places and 16 is greater than 15.
  • 8.
    W W W.L I B W R L D . B L O G S P O T. C O M Write the modules that will be required to be imported to execute the following functions in Python (i) floor( ) (ii) randint( ) Try it……………………………………….Yes you got it right it’s math
  • 9.
    W W W.L I B W R L D . B L O G S P O T. C O M 2 MARK
  • 10.
    W W W.L I B W R L D . B L O G S P O T. C O M Evaluate the following expressions: (i) not(20>6) or (19>7)and(20==20) (ii) 17%20 (I) The order of preferances is NOT > AND > OR so, check the conditions and solve it (ii) 17%20 gives 17 Since 17 is smaller than 20. It is default setting of python.
  • 11.
    W W W.L I B W R L D . B L O G S P O T. C O M Rewrite the following code in python after removing all syntax error(s). Underline each correction done in the code. 30=To for K in range(0,To) IF k%4==0: print (K*4) Else: print (K+3) To=30 for K in range(0,To): if K%4==0: print(K*4) else: print(K+3)
  • 12.
    W W W.L I B W R L D . B L O G S P O T. C O M What do you understand by the term type conversion? Explain with suitable example. Typecasting, or type conversion, is a method of changing an entity from one data type to another. It is used in computer programming to ensure variables are correctly processed by a function. An example of typecasting is converting an integer to a string. A = “17” B = int(A) print(b) It’s output will be 17. Here we converted “17” string into 17 integer value.
  • 13.
    W W W.L I B W R L D . B L O G S P O T. C O M a) Write the names of any two data types available in Python. b) Name the Python Library modules which need to be imported to invoke the followin functions : i) sqrt() ii) randint() a) String, Integer, Boolean(any two) b) math
  • 14.
    W W W.L I B W R L D . B L O G S P O T. C O M Evaluate the following expressions: a) 14+13%15 b) b) 50 > 6 and 3 > 13 or not 19 > 2 a) The preferences for arithmetic operators is +,- -- %,//,/* ----** 13%15 will give 13 since 13 is greater than 15 and the sum will be 27 b) It’s solution will be FALSE. Check previous questions for referance.
  • 15.
    W W W.L I B W R L D . B L O G S P O T. C O M Evaluate the following expressions: a) 6 * 3 + 4**2 // 5 – 8 b) b) 10 > 5 and 7 > 12 or not 18 > 3 a) The steps taken will be in order: 4**2 which will give 16 6*3 which will give 18 16//5 which will give 3 3-8 which will give -5 18+(-5) which will give 13 So the solution is 13. b) Do it yourself. The solution is FALSE.
  • 16.
    W W W.L I B W R L D . B L O G S P O T. C O M Rewrite the following code in Python after removing all syntax error(s). Underline each correction done in the code. V=80 for c in range(0,V) If c%4=0: print (c*4) Elseif c%5==0: print (c+3) else: print(c+10) V=80 for c in range(0,V) : if c%4==0: print (c*4) elif c%5==0: print (c+3) else: print(c+10)
  • 17.
    W W W.L I B W R L D . B L O G S P O T. C O M Rewrite the following code in Python after removing all syntax error(s). Underline each correction done in the code. Value=30 for VAL in range(0,Value) If val%4==0: print (VAL*4) Elseif val%5==0: print (VAL+3) else print(VAL+10) Try debugging(removing all errors) yourself. It is important to practice..
  • 18.
    W W W.L I B W R L D . B L O G S P O T. C O M Evaluate the following expressions: a) 5 * 3 + 3**2 % 5 – 8 b) b) 8>5 or 10 > 12 and not 18 > 3 Solve it yourself and comment below to show your participation.
  • 19.
    W W W.L I B W R L D . B L O G S P O T. C O M Rewrite the following code in Python after removing all syntax error(s). Underline each correction done in the code. Num=int(“Enter a number”) for N in range(0,Num) If n%2=0: print (n*4) Elseif n%5==0: Print (n+3) else print(n+10) Do it yourself and Comment the solution below.
  • 20.
    W W W.L I B W R L D . B L O G S P O T. C O M Rewrite the following code in Python after removing all syntax error(s). Underline each correction done in the code. 250 = Number WHILE Number<=1000: If Number=>750: print(Number) Number=Number+100 else print(Number*2) Number=Number+50 It is an easy question. I know that after doing the previous questions it must feel Boring but let’s do it. Comment below your hardwork.