Worksheets › Class 9 › Python Basics
Class 9 · Computational Thinking and AI worksheetPython Basics
CBSE Computational Thinking and AI. Operators and precedence, //, % and **, data types and conversion, input() and print(), tracing variables. Every sheet has 20 questions in three sections and an answer key, and the questions change every time.
Sample questions
Real questions from this chapter, as the app sets them. Tap Answer to see the answer and working.
Section A · multiple choice
- 1.
What does print(7 // 2) display?
- 4
- 1
- 3.5
- 3
Answer
(d) 3
- 2.
What does this print? print(30 * 5 % 6)
- 0
- 150
- 1
- −1
Answer
(a) 0
Python does ** first, then * / // %, then + and −, left to right
- 3.
What is the data type of the value of len('abc') in Python?
- str
- float
- int
- bool
Answer
(c) int
Section B · short answer
- 4.
What is the difference between / and // in Python?
Answer
/ gives the exact quotient as a float (7 / 2 = 3.5); // gives the whole-number part (7 // 2 = 3).
- 5.
What do these lines print? print(78 // 4) print(78 % 4) Give (a) the first line (b) the second.
Answer
(a) 19; (b) 2
78 = 4 × 19 + 2
Section C · long answer
- 6.
Write a Python program to convert a length in kilometres into metres, and explain each line.
Answer
km = float(input()) reads the length; m = km * 1000 converts it; print(m) shows the answer.
Fresh sheets for your child
In the app, every Python Basics sheet is new: the app remembers the questions your child has already had and leaves them out. Print the sheet as a PDF, or use notebook mode and write the answers in a notebook.
Coming soon for Android and iPhone.