Chapter 1_ Python Revision Tour _ Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT _ KnowledgeBoat
Chapter 1_ Python Revision Tour _ Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT _ KnowledgeBoat
Home / Class 12 - Computer Science with Python Sumita Arora / Python Revision Tour
Chapter 1
Python Revision Tour
Class 12 - Computer Science with Python Sumita Arora
Question 1
1. my_day_2
2. 2nd_day
3. Day_two
4. _2
Answer
2nd_day
Question 2
1. name
2. break
3. section
4. mark12
Answer
break
Question 3
1. eval
2. assert
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-answ… 1/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
3. nonlocal
4. pass
Answer
eval
Question 4
1. _init_
2. in
3. it
4. on
Answer
in
Question 5
1. Lists
2. Dictionary
3. Tuples
4. Class
Answer
Class
Question 6
1. x^y
2. x**y
3. x^^y
4. none of these
Answer
x**y
Question 7
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-answ… 2/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
1. 14
2. 27
3. 12
4. 0
Answer
27
14 + 13 % 15
= 14 + 13
= 27
Question 8
1. 0.0
2. 0
3. 1.0
4. 1
Answer
A % B // A
= 16 % 15 // 16
= 1 // 16
=0
Question 9
1. 17
2. 14
3. 15
4. 23
Answer
15
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-answ… 3/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
x = int(13.25 + 4/2)
x = int(13.25 + 2.0)
x = int(15.45)
x = 15
Question 10
1. 8/(4/2)
2. (8/4)/2
Answer
(8/4)/2
Question 11
1. <<, >>
2. **
3. I
4. %
Answer
**
Question 12
1. float('12')
2. int('12')
3. float('12.5')
4. int('12.5')
Answer
int('12.5')
1. print("hello\example\test.txt")
2. print("hello\\example\\test.txt")
3. print("hello\"example\"test.txt")
4. print("hello"\example"\test.txt")
Answer
print("hello\\example\\test.txt")
Question 14
1. Boolean
2. String
3. Int
4. Float
Answer
String
Question 15
1. @
2. %
3. +
4. #
Answer
%, +
Question 16
Eina
Mina
Dika
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-answ… 5/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
1. print('''Eina
\nMina
\nDika''')
2. print('''EinaMinaDika''')
3. print('Eina\nMina\nDika')
4. print('Eina
Mina
Dika')
Answer
print('Eina\nMina\nDika')
Reason —
1. print('''Eina
\nMina
\nDika''') — It is a multiline string and by adding \n extra line
will be added.
2. print('''EinaMinaDika''') — There is no new line character.
3. print('Eina\nMina\nDika') — It adds new line by \n new line
character.
4. print('Eina
Mina
Dika') — It creates an error because it is a multiline string with
no triple quotes.
Question 17
1. //
2. ?
3. <
4. and
Answer
//
Question 18
1. WEL
2. COME
3. WLOE
4. ECM
Answer
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-answ… 6/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
ECM
Reason — The slicing will start from index 1 and return at every
alternative step.
s[1] = E
s[3] = C
s[5] = M
output = ECM
Question 19
1. not
2. in
3. or
4. and
Answer
in
Question 20
1. (1,2,3)
2. ("One","Two","Three")
3. (10,)
4. ("One")
Answer
("One")
Question 1
Question 2
Question 3
Question 4
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-answ… 7/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
Question 5
Question 6
Question 7
Question 8
A break statement skips the rest of the loop and jumps over to the
statement following the loop.
Question 9
The continue statement skips the rest of the loop statements and
causes the next iteration of the loop to take place.
Question 10
Question 1
Answer
True
Question 2
Answer
True
4/(3*(2-1))
= 4/(3*1)
= 4/3
= 1.33333
4/3*(2-1)
= 4/3*1
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-answ… 8/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
= 4/3
= 1.33333
Question 3
Answer
False
4/(3*(4-2))
= 4/(3*2)
= 4/6
= 0.6666
4/3*(4-2)
= 4/3*2
= 1.3333*2
= 2.6666
Question 4
Answer
False
Question 5
Answer
True
Question 6
Answer
False
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-answ… 9/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
Question 7
Answer
False
Question 8
Answer
False
Question 9
Answer
True
Question 10
Answer
False
Question 1
Answer
(a)
Both Assertion and Reason are true and Reason is the correct
explanation of Assertion.
Explanation
In python, literal values have fixed memory locations and variable
names reference them as values. This means that, although we
can change the value of an integer variable, the process involves
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 10/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
Question 2
Answer
(c)
Explanation
A string literal is a sequence of characters surrounded by single or
double or triple single quotes or triple double quotes.
Question 3
Answer
(d)
Explanation
if is conditional statement and for is loop statement. Python is case
sensitive and its selection and looping statements are in lower
case.
Question 4
Answer
(a)
Both Assertion and Reason are true and Reason is the correct
explanation of Assertion.
Explanation
if is conditional statement and for is loop statement. Python is case
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 11/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
Question 5
Assertion. The break statement can be used with all selection and
iteration statements.
Answer
Chapter 1 CONTENTS
Python Revision Tour
(e) Multiple Choice Questions
Chapter 2 Fill in the Blanks
Python Revision Tour II
Both Assertion and Reason are false. True/False Questions
Assertions and Reasons
Chapter 3
Working with Functions Type A: Short Answer
Explanation Questions/Conceptual
Questions
Chapter 4
In python, the break statement can be used with iteration Type B: Application Based
Using Python Libraries Questions
statements only. Using break with conditional statements will result Type C: Programming
Chapter 5 Practice/Knowledge based
Questions
File Handling in syntax error — SyntaxError: 'break' outside loop
Chapter 8
Data Structures - I : Linear Lists Question 6
Chapter 10
Computer Networks - I Assertion. The break statement can be used with all selection and
Chapter 11
iteration statements.
Computer Networks - II
Explanation
In python, the break statement can be used with iteration
statements only. Using break with conditional statements will result
in syntax error — SyntaxError: 'break' outside loop
Type A: Short Answer Questions/Conceptual
Questions
Question 1
What are tokens in Python? How many types of tokens are allowed
in Python? Exemplify your answer.
Answer
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 12/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
Question 2
Answer
Question 3
What are literals in Python? How many types of literals are allowed
in Python?
Answer
Literals are data items that have a fixed value. The different types
of literals allowed in Python are:
1. String literals
2. Numeric literals
3. Boolean literals
4. Special literal None
5. Literal collections
Question 4
Answer
True.
Question 5
Price*Qty
class
For
do
4thCol
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 13/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
totally
Row31
_Amount
Answer
Question 6
1. MyName
2. True
3. 2ndName
4. My_Name
Answer
Question 7
1. Set
2. None
3. Integer
4. Real
Answer
Real
Question 8
1. ?
2. <
3. **
4. and
Answer
**
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 14/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
Question 9
Answer
Question 10
Answer
Question 11
Answer
Question 12
1. **
2. */
3. like
4. ||
5. is
6. ^
7. between
8. in
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 15/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
Answers
** ⇒ Exponentiation operator
is ⇒ Identity operator
^ ⇒ Bitwise XOR operator
in ⇒ Membership operator
Question 13
Answer
Question 14
Answer
Question 15
Answer
Question 16
1. True
2. False
3. None
4. Null
Answer
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 16/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
True
Question 17
Answer
Question 18(a)
Answer
Data types are used to identify the type of data a memory location
can hold and the associated operations of handling it. The data
that we deal with in our programs can be of many types like
character, integer, real number, string, boolean, etc. hence
programming languages including Python provide ways and
facilities to handle all these different types of data through data
types. The data types define the capabilities to handle a specific
type of data such as memory space it allocates to hold a certain
type of data and the range of values supported for a given data
type, etc.
Question 18(b)
Answer
1. Integer
2. String
3. List
4. Tuple
Question 19
Answer
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 17/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
1. Integers (signed)
2. Booleans
Question 20
Answer
1. Lists
2. Dictionaries
3. Sets
1. Integers
2. Floating-Point numbers
3. Booleans
4. Strings
5. Tuples
Question 21
Answer
Example: Example:
a, b = 5, 25.5 a, b = 5, 25.5
c=a+b c = int(a + b)
Question 22
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 18/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
Answer
Question 23
Answer
Question 24
Answer
for i in range(10):
if i == 2:
pass
else:
print("i =", i)
Question 25
30 = To
for K in range(0,To)
IF k%4 == 0:
print(K * 4)
Else:
print(K+3).
Answer
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 19/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
To = 30 # Correction 1
for K in range(0,To): # Correction 2
if K % 4 == 0: # Correction 3
print(K * 4)
else: # Correction 4
print(K+3) # Correction 5
Explanation
Question 26
(a) int
(b) float
(c) bool
(d) str
(e) function
(f) list of int
(g) list of str
(i)
if temp < 32 :
print ("Freezing")
(ii)
(iii)
M = []
for i in range (3) :
M.append(i)
print(M)
(iv)
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 20/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
if 'Donald' in L[1 : n] :
print(L)
(v)
if n % 2 == 0 :
print("Freezing")
(vi)
L = inputline.split()
while L != ( ) :
print(L)
L = L[1 :]
(vii)
Answer
(i) bool
(ii) str
(iii) list of int
(iv) int
(v) bool
(vi) list of str
(vii) str
Question 27
for i in range(2,7,2):
print(i*'$')
Answer
Output
$$
$$$$
$$$$$$
Explanation
For i = 2 , it prints $$ .
For i = 4 , it prints $$$$ .
Question 1
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 21/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
Fill in the missing lines of code in the following code. The code
reads in a limit amount and a list of prices and prints the largest
price that is less than the limit. You can assume that all prices and
the limit are positive numbers. When a price 0 is entered the
program terminates and prints the largest price that is less than the
limit.
Answer
Question 2a
count = 0
while count < 10:
print ("Hello")
count += 1
Answer
Output
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 22/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
Hello
Hello
Question 2b
x = 10
y = 0
while x > y:
print (x, y)
x = x - 1
y = y + 1
Answer
Output
10 0
9 1
8 2
7 3
6 4
Explanation
x y Output Remarks
10 0 10 0 1st Iteration
10 0
9 1 2nd Iteration
91
10 0
8 2 91 3rd Iteration
82
10 0
91
7 3 4th Iteration
82
73
10 0
91
6 4 82 5th Iteration
73
64
Question 2c
keepgoing = True
x=100
while keepgoing :
print (x)
x = x - 10
if x < 50 :
keepgoing = False
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 23/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
Answer
Output
100
90
80
70
60
50
Explanation
Question 2d
x = 45
while x < 50 :
print (x)
Answer
As the loop control variable x is not updated inside the loop neither
there is any break statement inside the loop so it becomes an
infinite loop.
Question 2e
for x in [1,2,3,4,5]:
print (x)
Answer
Output
1
2
3
4
5
Explanation
x will be assigned each of the values from the list one by one and
that will get printed.
Question 2f
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 24/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
for p in range(1,10):
print (p)
Answer
Output
1
2
3
4
5
6
7
8
9
Explanation
Question 2g
Answer
Output
-500
-400
-300
-200
-100
0
100
200
300
400
Explanation
Question 2h
x = 10
y = 5
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 25/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
for i in range(x-y * 2):
print (" % ", i)
Answer
Explanation
x-y*2
⇒ 10 - 5 * 2
⇒ 10 - 10 [∵ * has higher precedence than -]
⇒0
Question 2i
c = 0
for x in range(10):
for y in range(5):
c += 1
print (c)
Answer
Output
50
Explanation
Question 2j
x = [1,2,3]
counter = 0
while counter < len(x):
print(x[counter] * '%')
for y in x:
print(y * '* ')
counter += 1
Answer
Output
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 26/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
%
*
* *
* * *
%%
*
* *
* * *
%%%
*
* *
* * *
Explanation
In this code, the for loop is nested inside the while loop. Outer
while loop runs 3 times and prints % as per the elements in x in
each iteration. For each iteration of while loop, the inner for loop
executes 3 times printing * as per the elements in x.
Question 2k
for x in 'lamp':
print(str.upper(x))
Answer
Output
L
A
M
P
Explanation
The for loop extracts each letter of the string 'lamp' one by one and
place it in variable x. Inside the loop, x is converted to uppercase
and printed.
Question 2l
x = 'one'
y = 'two'
counter = 0
while counter < len(x):
print(x[counter], y[counter])
counter += 1
Answer
Output
o t
n w
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 27/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
e o
Explanation
Inside the while loop, each letter of x and y is accessed one by one
and printed.
Question 2m
Answer
Output
apple
pear
peach
Explanation
Question 2n
Answer
Output
apple
PEAR
PEACH
grapefruit
Explanation
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 28/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
Question 3
Which of the following is the correct output for the execution of the
following Python statement ?
print(5 + 3 ** 2 / 2)
1. 32
2. 8.0
3. 9.5
4. 32.0
Answer
9.5
Explanation
5 + 3 ** 2 / 2
=5+9/2
= 5 + 4.5
= 9.5
Question 4(i)
How many times will the following for loop execute and what's the
output?
Answer
Question 4(ii)
How many times will the following for loop execute and what's the
output?
for i in range(1,3,1):
for j in range(i+1):
print('*')
Answer
Output
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 29/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
*
*
*
*
*
Explanation
Question 5
Answer
Output
Jay
Finished!
Riya
Finished!
Tanu
Got it!
Explanation
The for loop iterates over each name in the list and prints it. If the
name does not begin with the letter T, Finished! is printed after the
name. If the name begins with T, break statement is executed that
terminates the loop. Outside the loop, Got it! gets printed.
Question 6
Is the loop in the code below infinite? How do you know (for sure)
before you run it?
m = 3
n = 5
while n < 10:
m = n - 1
n = 2 * n - m
print(n, m)
Answer
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 30/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
n=2*n-m
n = 2 * n - (n - 1)
⇒n=2*n-n+1
⇒ n = 2n - n + 1
⇒n=n+1
Question 1
Solution
x = int(input("Enter x: "))
if x < 0:
print("negative")
elif x > 0:
print("positive")
else:
print("zero")
Output
Enter x: -5
negative
Enter x: 0
zero
Enter x: 5
positive
Question 2
Solution
if x % 2 == 0:
print("True")
else:
print("False")
Output
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 31/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
Enter a number: 10
True
Enter a number: 5
False
Question 3
Solution
days = 365
hours = 24
mins = 60
secs = 60
secsInYear = days * hours * mins * secs
print("Number of seconds in a year =", secsInYear)
Output
Question 4
Write a Python program that accepts two integers from the user
and prints a message saying if first number is divisible by second
number or if it is not.
Solution
if a % b == 0:
print(a, "is divisible by", b)
else:
print(a, "is not divisible by", b)
Output
Question 5
Write a program that asks the user the day number in a year in the
range 2 to 365 and asks the first day of the year — Sunday or
Monday or Tuesday etc. Then the program should display the day
on the day-number that has been input.
Solution
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 32/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
if currDayIdx >= 7:
currDayIdx = currDayIdx - 7
Output
Question 6
Solution
def feetToInches(lenFeet):
lenInch = lenFeet * 12
return lenInch
def getInput():
len = int(input("Enter length in feet: "))
return len
def displayLength(l):
print("Length in inches =", l)
ipLen = getInput()
inchLen = feetToInches(ipLen)
displayLength(inchLen)
Output
Question 7
Solution
n = int(input("Enter N: "))
sum = 0
if n < 0:
for i in range(2 * n, n + 1):
sum += i
else:
for i in range(n, 2 * n + 1):
sum += i
Output
Enter N: 5
Sum = 45
Enter N: -5
Sum = -45
Question 8
Sample run :
Solution
Output
Question 9
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 34/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
Solution
print('Miles | Kilometres')
print(1, "\t", 1.60934)
for i in range(10, 101, 10):
print(i, "\t", i * 1.60934)
Output
Miles | Kilometres
1 1.60934
10 16.0934
20 32.1868
30 48.2802
40 64.3736
50 80.467
60 96.5604
70 112.6538
80 128.7472
90 144.8406
100 160.934
Question 10
Write another program printing a table with two columns that helps
convert pounds in kilograms.
Solution
print('Pounds | Kilograms')
print(1, "\t", 0.4535)
for i in range(10, 101, 10):
print(i, "\t", i * 0.4535)
Output
Pounds | Kilograms
1 0.4535
10 4.535
20 9.07
30 13.605
40 18.14
50 22.675
60 27.21
70 31.745
80 36.28
90 40.815
100 45.35
Question 11
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 35/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
Solution
Output
Next
Python Revision Tour II
Class - 6 Concise Biology Selina Solutions Class - 9 ICSE Mathematics Sample Paper Tests Pricing
Class - 6 Veena Bhargava Geography Solutions Class - 9 ICSE Biology Practice Tests About Us
Class - 6 Effective History & Civics Solutions Class - 10 ICSE Mathematics Practice Tests Contact Us
Class - 7 Concise Physics Selina Solutions Class - 10 ICSE Mathematics Sample Paper Tests Privacy Policy
Class - 7 Concise Chemistry Selina Solutions Class - 10 ICSE Biology Sample Paper Tests Terms of Service
Class - 7 Dalal Simplified Middle School Chemistry Solutions Class - 10 ICSE Computer Applications Sample Paper Tests
Class - 7 Concise Biology Selina Solutions Class - 12 CBSE Computer Science Practice Tests
Class - 7 Living Science Biology Ratna Sagar Solutions Class - 12 CBSE Computer Science Sample Paper Tests
Class - 7 Around the World Geography Solutions Class - 12 CBSE Informatics Practices Sample Paper Tests
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 36/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
Class - 7 Veena Bhargava Geography Solutions STUDYLIST
Class - 8 Concise Chemistry Selina Solutions Java Number Programs (ICSE Classes 9 / 10)
Class - 8 Dalal Simplified Middle School Chemistry Solutions Java Number Programs (ISC Classes 11 / 12)
Class - 8 Concise Biology Selina Solutions Output Questions for Class 10 ICSE Computer Applications
Class - 8 Living Science Biology Ratna Sagar Solutions Algorithms & Flowcharts for ICSE Computers
Class - 8 Around the World Geography Solutions ICSE Class 8 Computers Differentiate Between the Following
Class - 8 Veena Bhargava Geography Solutions CBSE Class 12 Computer Science Important Output Questions
Class - 8 Effective History & Civics Solutions CBSE Class 12 Computer Science Assertion Reason Questions
Class - 8 Kips Logix Computers Solutions CBSE Class 12 Computer Science File Handling Questions
Class - 9 Dalal Simplified ICSE Chemistry Solutions Class - 9 NCERT Mathematics Solutions
Class - 9 Total Geography Morning Star Solutions Class - 9 NCERT Geography Contemporary India 1 Solutions
Class - 9 Veena Bhargava Geography Solutions Class - 9 NCERT History India & Contemporary World 1 Solutions
Class - 9 Total History & Civics Solutions Class - 9 Sumita Arora Computer Code 165 Solutions
Class - 9 Kips Logix Computers Solutions Class - 9 Kips Cyber Beans Computer Code 165 Solutions
Class - 10 Dalal Simplified ICSE Chemistry Solutions Class - 10 NCERT Geography Contemporary India 2 Solutions
Class - 10 Concise Biology Selina Solutions Class - 10 NCERT History India & Contemporary World 2 Solutions
Class - 10 Total Geography Morning Star Solutions Class - 10 NCERT Democratic Politics 2 (Civics) Solutions
Class - 10 Veena Bhargava Geography Solutions Class - 10 NCERT Economic Development Solutions
Class - 10 Total History & Civics Solutions Class - 10 Sumita Arora Computer Code 165 Solutions
Class - 10 Sumita Arora ICSE Computers Solutions Class - 10 Kips Cyber Beans Computer Code 165 Solutions
Class - 10 Kips Logix Computers Solutions Class - 11 CBSE Sumita Arora Python Solutions
ICSE/ISC SOLVED QUESTION PAPERS
Class - 11 CBSE Preeti Arora Python Solutions
Class - 10 ICSE Maths Solved Competency Focused Questions
Class - 11 CBSE Informatics Practices Preeti Arora Solutions
Class - 10 ICSE Biology Solved Competency Focused Questions
Class - 12 CBSE Sumita Arora Python Solutions
ICSE Class 10 Computers Solved 10 Yrs Question Papers
Class - 12 CBSE Preeti Arora Python Solutions
Sample Papers ICSE Class 10 Computer Applications
Class - 12 NCERT Computer Science Solutions
ICSE Class 10 Physics Solved 10 Yrs Question Papers
Class - 12 CBSE Informatics Practices Sumita Arora Solutions
Sample Papers ICSE Class 10 Physics
Class - 12 CBSE Informatics Practices Preeti Arora Solutions
ICSE Class 10 Chemistry Solved 10 Yrs Question Papers
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 37/38
3/20/25, 5:21 AM Chapter 1: Python Revision Tour | Solutions of Computer Science with Python by Sumita Arora for Class 12 CBSE & NCERT | …
https://www.knowledgeboat.com/learn/sumita-arora-python-computer-science-class-12-cbse/solutions/Y3E4M/revision-tour-1#type-a-short-ans… 38/38