DEMO CLASS SCRIPT | Python Ch.
8 & 9 | Class 10 CBSE
DEMO CLASS — SPOKEN SCRIPT
Class 10 | Computer Science
Chapter 8: Introduction to Python | Chapter 9: Conditional & Looping Statements
Duration: 45 Minutes
HOW TO USE THIS SCRIPT: Read the regular text aloud to students. [Stage directions in orange italics] are
actions for you — do not read aloud. ⏱ Time markers help you stay on schedule.
SECTION 1: Opening & Hook (Minutes 0–3)
⏱ 0:00 — Begin here as students settle
Good morning, everyone! Please take your seats quickly — we have an exciting 45 minutes ahead of
us.
Let me start with a question. Raise your hand if you have used Google Maps, YouTube, or Instagram
today.
[Pause — wait for hands]
Almost everyone. Now here is something interesting: every single one of those apps — Google Maps,
YouTube, Instagram — was built using a programming language. And one of the most popular
languages used to build them? Python.
Today, we are going to learn Python. By the end of this class, you will write your very first working
Python program. Not theory. Actual code that runs.
Let us begin.
SECTION 2: What is Python? (Minutes 3–8)
⏱ 3:00 — Introduction to Python
Chapter 8 of your textbook is called Introduction to Python. Let us start with the basics.
Python is a programming language. A programming language is simply a way of giving instructions to a
computer in a language both you and the computer can understand.
Python was created by a man named Guido van Rossum, and it was first released in 1991. So it has
been around for over 30 years — and it is more popular today than ever before.
Page 1 | For teacher use only
DEMO CLASS SCRIPT | Python Ch. 8 & 9 | Class 10 CBSE
Now, why is Python so popular? Let me give you five reasons. I want you to write these down.
[Write on the board: Features of Python]
One — Easy to Read and Write. Python looks almost like plain English. Compare this to other
languages where the code looks like a secret code. Python is clean, simple, and readable.
Two — Case Sensitive. This is very important and students often forget it. In Python, the word 'Name'
with a capital N and 'name' with a small n are two completely different things. We will see why this
matters when we write code.
Three — Free and Open Source. You do not need to pay anything to use Python. You can download it
for free, use it for free, and share it freely.
Four — Cross-Platform. This means Python works on Windows, Mac, and Linux. Write your code once,
run it anywhere.
Five — Interpreted Language. When you write Python code, Python reads it line by line and executes it
immediately. It does not need to convert the whole program before running. This makes it easier to find
and fix mistakes.
💡 Teacher tip: Point to the board as you list each feature. Ask students to repeat: 'Easy, Case-Sensitive,
Free, Cross-Platform, Interpreted.'
Good. Now let us talk about where we actually write Python code.
Python comes with a built-in editor called IDLE — I-D-L-E. It stands for Integrated Development and
Learning Environment. Think of it as a notebook where you write your Python programs.
To open IDLE on a Windows computer: Start menu — All Programs — Python 3 — IDLE. Once it
opens, you will see a window called the Python Shell. This is where Python talks back to you.
There are two modes in IDLE. First, the Interactive Mode — you type one line, press Enter, and Python
immediately shows you the result. Second, the Script Mode — you write a complete program, save it,
and then run it. For most programs we write today, we will use Script Mode.
SECTION 3: Variables, Data Types & Input/Output (Minutes 8–20)
⏱ 8:00 — Core Python concepts
3A: Variables
Page 2 | For teacher use only
DEMO CLASS SCRIPT | Python Ch. 8 & 9 | Class 10 CBSE
Now we come to one of the most important concepts in any programming language: variables.
What is a variable? Think of it like a box. You give the box a name, and inside the box you store some
value — a number, a name, anything. Whenever you need that value, you just use the box's name.
In Python, creating a variable is called assignment. You use the equals sign.
[Write on the board:]
age = 15
name = "Aryan"
marks = 92.5
Here, 'age' is a variable that stores the number 15. 'name' stores the text Aryan. 'marks' stores 92.5.
Now, there are rules for naming variables. Let me give you the three most important ones.
Rule One: A variable name must start with a letter or an underscore. It cannot start with a number. So
'age' is valid. '1age' is not valid.
Rule Two: No spaces allowed. If you want two words, use an underscore. So 'student_name' is fine.
'student name' with a space will give you an error.
Rule Three: You cannot use Python keywords as variable names. Keywords are special words that
Python has already reserved for itself — words like 'if', 'for', 'while', 'print'. You cannot name your
variable 'if' or 'for'.
💡 Teacher tip: Ask students: 'Is this a valid variable name?' Give 3 quick examples: '2marks' (invalid),
'student_roll' (valid), 'for' (invalid). Keep it fast — 30 seconds.
3B: Data Types
Every variable in Python has a data type. The data type tells Python what kind of value is being stored.
Your textbook covers six data types. For today, let us focus on the three most important ones.
First: Integer. This is a whole number — no decimal point. Examples: 5, 100, minus 7. In Python we
write: marks = 85
Second: Float. This is a number with a decimal point. Examples: 9.8, 3.14, 95.5. In Python: percentage
= 95.5
Third: String. This is any text — letters, words, sentences. In Python, strings are always written inside
quotation marks. In Python: city = "Delhi"
Page 3 | For teacher use only
DEMO CLASS SCRIPT | Python Ch. 8 & 9 | Class 10 CBSE
Quick question for the class — if I write: price = 250 — what data type is price? Integer. Good.
What if I write: price = 250.00 — now what data type? Float. Excellent.
What if I write: price = "250" — now what type? String. Yes! Even though it looks like a number, the
quotation marks make it a string. Python cannot do maths with it directly.
3C: Input and Output
Now let us talk about how Python communicates — how it takes information from the user, and how it
displays information back.
For output — displaying something on the screen — we use the print function.
[Write on the board:]
print("Hello, World!")
Whatever you write inside the brackets and quotation marks, Python will display it on screen. This is
actually the very first program every programmer in the world writes when they learn a new language.
'Hello, World!' Welcome to the club.
You can also print the value of a variable:
name = "Priya"
print(name)
This will display: Priya — without any quotation marks. Python just shows the value stored in the
variable.
Now for input — taking information from the user — we use the input function.
name = input("Enter your name: ")
When Python runs this line, it displays the message 'Enter your name:' on the screen and waits. The
user types something and presses Enter. Whatever they type is stored in the variable 'name'.
Here is a very important rule about input: input always returns a string. Always. Even if the user types
the number 25, Python stores it as the string '25', not the number 25. This matters when you want to do
arithmetic.
To convert a string to a number, we use int() or float(). Watch:
age = int(input("Enter your age: "))
Page 4 | For teacher use only
DEMO CLASS SCRIPT | Python Ch. 8 & 9 | Class 10 CBSE
Now whatever the user types is converted to an integer. If they type 16, Python stores the number 16,
not the string '16'. Now you can add or subtract from it.
💡 Teacher tip: Write both versions on board — with and without int(). Ask: 'What happens if someone types
their name when you expected a number?' This sparks curiosity without going off-track.
3D: Let's Write Our First Program
⏱ 17:00 — First live program
Alright. Enough theory. Let us write our first real Python program together. I want everyone to watch
carefully.
[Open IDLE in Script Mode. Type the following slowly, explaining each line as you go.]
We are going to write a program that asks for the length and breadth of a rectangle, and calculates its
area and perimeter.
length = float(input("Enter length: "))
This line asks the user to enter the length. We use float because length might be a decimal number.
breadth = float(input("Enter breadth: "))
Same for breadth.
area = length * breadth
The asterisk * means multiplication in Python. We store the result in a variable called area.
perimeter = 2 * (length + breadth)
Standard formula for perimeter. Python follows BODMAS just like mathematics.
print("Area =", area)
print("Perimeter =", perimeter)
These two lines display the results. Notice: when we put a comma between the text and the variable
name, Python prints both together on the same line.
[Run the program. Enter length = 5, breadth = 3. Show output: Area = 15.0, Perimeter = 16.0]
Look at that. We gave Python two numbers, it calculated the area and perimeter, and printed the
results. That is a complete, working Python program.
Page 5 | For teacher use only
DEMO CLASS SCRIPT | Python Ch. 8 & 9 | Class 10 CBSE
SECTION 4: Operators (Minutes 20–25)
⏱ 20:00 — Operators
Before we move to Chapter 9, let us quickly cover operators — the symbols Python uses to perform
calculations and comparisons.
Chapter 8 covers three types of operators. Let us go through each one.
Type One: Arithmetic Operators. These are used for maths.
[Write this table on the board:]
+ Addition 5 + 3 = 8
- Subtraction 5 - 3 = 2
* Multiplication 5 * 3 = 15
/ Division 5 / 2 = 2.5 (gives decimal)
// Floor Division 5 // 2 = 2 (drops decimal)
% Modulus 5 % 2 = 1 (gives remainder)
** Exponent 2 ** 3 = 8 (2 to the power 3)
The ones students often confuse are these three. Slash gives a decimal result. Double-slash drops the
decimal and gives only the whole number. Percent gives the remainder. These are very commonly
asked in exams.
Quick mental maths. What is 10 % 3?
[Pause for answers — correct answer is 1]
Good. 10 divided by 3 is 3 remainder 1. So 10 % 3 = 1.
Type Two: Relational Operators. These compare two values and give a True or False result.
== Equal to 5 == 5 gives True
!= Not equal to 5 != 3 gives True
> Greater than 7 > 3 gives True
< Less than 2 < 9 gives True
>= Greater than or equal 5 >= 5 gives True
<= Less than or equal 3 <= 4 gives True
Important: double equals == is for comparison. Single equals = is for assignment. Students often write
= when they mean == in their conditions. That is one of the most common mistakes in Python.
Remember: one equals means store, two equals means compare.
Type Three: Logical Operators — and, or, not. These combine multiple conditions. We will use them
more in Chapter 9. For now, just know they exist.
Page 6 | For teacher use only
DEMO CLASS SCRIPT | Python Ch. 8 & 9 | Class 10 CBSE
SECTION 5: Chapter 9 — Conditional Statements (Minutes 25–33)
⏱ 25:00 — Chapter 9 begins
Excellent. Now we move to Chapter 9: Conditional and Looping Statements. This is where Python gets
really powerful.
Think about this. Every day you make decisions. If it is raining, you carry an umbrella. Otherwise, you
do not. Programs also need to make decisions. Conditional statements allow Python to choose what to
do based on a condition.
5A: The if Statement
The simplest conditional statement is 'if'. The structure is:
[Write on the board:]
if condition:
statement
Read this as: IF this condition is true, THEN do this statement.
Notice the colon at the end of the if line. It is mandatory. And notice the indentation — the statement
inside the if block is pushed in by four spaces. In Python, indentation is not optional. It is the rule.
Without proper indentation, your code will give an error.
Let us write a quick example:
marks = int(input("Enter your marks: "))
if marks >= 33:
print("You have passed.")
If the user enters 50, the condition 50 >= 33 is True, so Python prints 'You have passed.' Simple and
powerful.
5B: The if...else Statement
But what if we want to do something when the condition is False as well? We use if...else.
if marks >= 33:
print("You have passed.")
else:
print("You have failed.")
Page 7 | For teacher use only
DEMO CLASS SCRIPT | Python Ch. 8 & 9 | Class 10 CBSE
Now Python checks the condition. If it is True, it runs the first block. If it is False, it runs the else block.
One or the other. Never both.
5C: The if...elif...else Statement
What if you have more than two possibilities? For example, assigning grades — A, B, C, D, Fail. For
that, we use elif. Elif stands for 'else if'. It lets you check multiple conditions in sequence.
if marks >= 90:
print("Grade: A")
elif marks >= 75:
print("Grade: B")
elif marks >= 60:
print("Grade: C")
elif marks >= 33:
print("Grade: D")
else:
print("Fail")
Python checks each condition from top to bottom. The moment it finds one that is True, it runs that
block and skips all the rest. So if marks = 82, the first condition 82 >= 90 is False, the second condition
82 >= 75 is True, Python prints Grade B, and stops. It does not even check the remaining conditions.
[Run the grade program live in IDLE with marks = 82. Show output.]
💡 Teacher tip: Ask students: 'What grade will Python give for marks = 60?' Answer: C. 'What about marks =
32?' Answer: Fail. Quick verbal check — 30 seconds.
SECTION 6: Looping Statements (Minutes 33–41)
⏱ 33:00 — Loops
Now let us talk about loops. Here is the problem loops solve.
Suppose I want to print 'Hello' ten times. Without loops, I would have to write print('Hello') ten separate
times. Now imagine printing it a hundred times, or a thousand times. Clearly, there must be a better
way. That better way is a loop.
A loop tells Python: repeat this block of code a certain number of times, or until a condition becomes
False.
Chapter 9 covers the for loop. Let us look at it.
Page 8 | For teacher use only
DEMO CLASS SCRIPT | Python Ch. 8 & 9 | Class 10 CBSE
6A: The for Loop
The for loop repeats a block of code for each item in a sequence. The most common sequence we use
is range().
Range is a function that generates a sequence of numbers. range(5) gives us 0, 1, 2, 3, 4 — five
numbers, starting from 0.
for i in range(5):
print(i)
This loop will print: 0, 1, 2, 3, 4. The variable i takes each value from the range, one at a time. First i =
0, Python prints 0. Then i = 1, Python prints 1. And so on until i = 4.
Now watch this. We can use range with a start, stop, and step:
for i in range(1, 11):
print(i)
range(1, 11) gives numbers from 1 to 10. Note: the stop value is excluded. So we write 11 to get up to
10.
Let us do something more practical. Let us print the multiplication table for any number the user gives
us:
num = int(input("Enter a number: "))
for i in range(1, 11):
print(num, "x", i, "=", num * i)
[Run this in IDLE. Enter num = 7. Show the full 7-times table printed out.]
In just three lines of code, Python printed the entire multiplication table. That is the power of loops.
6B: break and continue
Sometimes inside a loop, you want to stop early or skip a particular iteration. Python gives us two
special statements for this.
break — this immediately exits the loop. Python stops the loop entirely and moves to the next part of
the program.
for i in range(1, 11):
if i == 6:
break
print(i)
Page 9 | For teacher use only
DEMO CLASS SCRIPT | Python Ch. 8 & 9 | Class 10 CBSE
This loop would normally print 1 to 10. But when i reaches 6, the break statement fires, and the loop
stops. Output: 1, 2, 3, 4, 5.
continue — this skips the rest of the current iteration and goes to the next one. It does not exit the loop,
it just skips one step.
for i in range(1, 11):
if i == 6:
continue
print(i)
Now when i = 6, the continue skips the print statement for that one iteration. Output: 1, 2, 3, 4, 5, 7, 8,
9, 10 — everything except 6.
So to summarise: break exits the loop. continue skips one step and keeps going.
💡 Teacher tip: Draw a quick diagram on the board showing the difference: break = door closed, continue =
skip one step but keep walking.
SECTION 7: Summary Program (Minutes 41–43)
⏱ 41:00 — Consolidation program
We have covered a lot today. Let us write one final program that uses everything — variables, input,
conditionals, and a loop — all together.
This program will ask the user how many students are in the class, take marks for each student, and
print whether each one passed or failed.
n = int(input("How many students? "))
for i in range(1, n+1):
marks = int(input("Enter marks for student " + str(i) + ": "))
if marks >= 33:
print("Student", i, "- Pass")
else:
print("Student", i, "- Fail")
[Run with n = 3. Enter marks 75, 20, 45. Show output for each student.]
This program uses a for loop to go through each student. Inside the loop, it uses an if...else condition to
decide Pass or Fail. Four concepts, one program, twelve lines of code.
Page 10 | For teacher use only
DEMO CLASS SCRIPT | Python Ch. 8 & 9 | Class 10 CBSE
SECTION 8: Closing & Recap (Minutes 43–45)
⏱ 43:00 — Closing
All right. Let us take two minutes to recap what we covered today.
Chapter 8: We learned what Python is, its key features — easy to read, case-sensitive, free, cross-
platform, and interpreted. We learned about variables and data types — integer, float, string. We
learned how to take input with input() and display output with print(). And we learned about arithmetic
and relational operators.
Chapter 9: We learned about conditional statements — if, if...else, and if...elif...else. We learned about
the for loop and how to use range(). And we learned about break and continue.
One question before I let you go. Tell me in one word: what is the difference between = and == in
Python?
[Take 2-3 student answers. Affirm: = is assignment, == is comparison.]
Perfect. For your practice today, try writing two programs on your own. First: write a program that takes
a number from the user and prints its first five multiples. Second: write a program that checks whether a
number is even or odd.
Both programs use exactly what we covered today. If you can write those two programs, you have
understood the chapter.
Thank you. See you in the next class.
QUICK REFERENCE: Key Code Blocks
Rectangle Area Program
length = float(input("Enter length: "))
breadth = float(input("Enter breadth: "))
area = length * breadth
perimeter = 2 * (length + breadth)
print("Area =", area)
print("Perimeter =", perimeter)
Grade Checker Program
marks = int(input("Enter your marks: "))
if marks >= 90:
print("Grade: A")
elif marks >= 75:
print("Grade: B")
Page 11 | For teacher use only
DEMO CLASS SCRIPT | Python Ch. 8 & 9 | Class 10 CBSE
elif marks >= 60:
print("Grade: C")
elif marks >= 33:
print("Grade: D")
else:
print("Fail")
Multiplication Table Program
num = int(input("Enter a number: "))
for i in range(1, 11):
print(num, "x", i, "=", num * i)
Pass/Fail Checker for Class (Loop + Conditional)
n = int(input("How many students? "))
for i in range(1, n+1):
marks = int(input("Enter marks for student " + str(i) + ": "))
if marks >= 33:
print("Student", i, "- Pass")
else:
print("Student", i, "- Fail")
Page 12 | For teacher use only