1. Session Overview
| Class | VI |
|---|---|
| Subject | Computer Science |
| Chapter | Chapter 7: Introduction to Python |
| Session | 2 |
| Topic | Variables in Python; Script Mode; Data Types; print(); input() |
| Suggested Duration | 40–45 minutes |
2. Research Record
Curriculum Research
The session develops foundational programming skills required for students to write simple Python programs involving variables, data, output and user input.
Content Research
- Variables
- Identifiers
- Assignment
- Script Mode
- Basic Python data types
print()functioninput()function- Type conversion using
int()andfloat()
Learner Research
Grade VI students benefit from connecting programming concepts with familiar ideas such as names, ages, marks, colours and favourite subjects.
Prerequisites
- Basic understanding of Python.
- Opening a Python programming environment.
- Basic knowledge of instructions and commands.
- Understanding of simple values such as numbers and text.
Likely Misconceptions
- A variable is permanently fixed to one value.
=means mathematical equality.input()automatically produces a number.print()prints on paper.- Text and numbers are stored in exactly the same way.
- Script Mode executes only one line of code.
3. Learning Objectives
By the end of the session, students will be able to:
- Explain what a variable is.
- Create and assign values to variables.
- Identify common Python data types.
- Explain the purpose of Script Mode.
- Display information using
print(). - Accept information from the user using
input(). - Use basic type conversion for numeric input.
- Write a simple interactive Python program.
4. Variables in Python
A variable is a name used to refer to a value stored in a program.
For example:
name = "Riya"
age = 11
marks = 85
Here, name, age and marks
are variables.
= symbol is the assignment operator in Python.
It assigns the value on the right to the variable on the left.
5. Naming Variables
Some basic rules for variable names are:
- A variable name can contain letters, digits and underscores.
- A variable name cannot begin with a digit.
- Spaces should not be used in variable names.
- Python is case-sensitive.
- Python keywords should not be used as variable names.
| Valid | Invalid |
|---|---|
student_name |
student name |
age2 |
2age |
marks |
class |
6. Working in Script Mode
Script Mode allows us to write a complete Python program in a file and execute the program together.
A typical workflow is:
- Open the Python IDE.
- Create a new Python file.
- Write the program.
- Save the file with a
.pyextension. - Run the program.
- Observe the output.
- Correct errors if necessary.
7. Data Types in Python
A data type tells us what kind of value is being stored.
| Data Type | Meaning | Example |
|---|---|---|
int |
Whole number | 25 |
float |
Decimal number | 25.5 |
str |
Text/string | "Python" |
bool |
True or False | True |
Examples
age = 12
height = 4.8
name = "Aarav"
is_student = True
8. Using the print() Function
The print() function displays information on the
screen.
print("Hello Python!")
Output:
Hello Python!
Printing Variables
name = "Aarav"
age = 11
print(name)
print(age)
Printing Multiple Values
name = "Aarav"
age = 11
print("Name:", name)
print("Age:", age)
9. Using the input() Function
The input() function allows a Python program to
accept information entered by the user.
name = input("Enter your name: ")
print("Hello", name)
If the user enters:
Anant
The program displays:
Hello Anant
input() are strings by default.
When numeric input is required, type conversion may be necessary.
10. Taking Numeric Input
To convert input into an integer, use int().
age = int(input("Enter your age: "))
print("Next year you will be", age + 1)
For decimal numbers, use float().
height = float(input("Enter your height: "))
print("Your height is", height)
11. Complete Example: Student Introduction
name = input("Enter your name: ")
age = int(input("Enter your age: "))
school = input("Enter your school: ")
print("Student Name:", name)
print("Age:", age)
print("School:", school)
12. Teaching Strategy
| Stage | Teacher Action | Student Action |
|---|---|---|
| Recall | Review Python and basic commands. | Answer oral questions. |
| Demonstrate | Create variables and display them. | Observe and predict output. |
| Explain | Introduce data types and Script Mode. | Record and discuss concepts. |
| Guided Practice | Demonstrate print() and input(). |
Write programs with guidance. |
| Independent Practice | Provide a programming problem. | Develop and run the program. |
13. Classroom Activity
Activity: My Introduction Program
Students create a program that asks for:
- Name
- Age
- Class
- Favourite subject
- Favourite colour
The program should display all the information neatly.
14. Computer Lab Activity
Task 1: Personal Information
Write a Python program that accepts your name, age and favourite subject and displays them.
Task 2: Age Calculator
Ask the user for their current age and display their age after one year.
Task 3: Marks
Accept marks in two subjects and display the marks entered.
15. Predict the Output
Question 1
x = 10
y = 20
print(x)
print(y)
Question 2
name = "Python"
print("I am learning", name)
Question 3
age = 12
print(age + 1)
Students should explain their answers before running the programs.
16. Assessment
| Assessment Method | Evidence of Learning |
|---|---|
| Oral Questioning | Variables, data types, Script Mode and functions. |
| Worksheet | Identify data types and predict outputs. |
| Practical Observation | Create, save and execute a Python script. |
| Programming Task | Write an interactive program using input() and print(). |
17. Quick Check
- What is a variable?
- What does the assignment operator
=do? - What is Script Mode?
- Name four common Python data types.
- What is the purpose of
print()? - What is the purpose of
input()? - What type of value does
input()return by default? - Why do we use
int()with numeric input?
18. Homework
- Write a Python program to store your name, age and class in variables and display them.
- Write a program that accepts the user's name and displays a welcome message.
- Write a program that accepts two numbers and displays them.
-
Identify the data type of each:
25,25.5,"Computer",True. -
Explain the difference between
print()andinput().
19. Extension Challenge 🚀
Create a program that asks the user for the length and breadth of a rectangle and displays its area.
length = float(input("Enter length: "))
breadth = float(input("Enter breadth: "))
area = length * breadth
print("Area =", area)
Challenge: Can you modify the program to calculate the perimeter as well?
20. Summary
In this session, students learned how Python programs store information using variables, how complete programs can be written and executed in Script Mode, and how different data types represent different kinds of values.
Students also learned to display information using
print() and accept user input using
input(). They were introduced to
int() and float() for converting
input into numeric values.
21. Teacher Reflection
- Could students distinguish variables from values?
- Could students identify basic data types?
- Could students create and save a Python script?
- Could students use
print()correctly? - Did students understand that
input()returns a string by default? - Which students required additional support with type conversion?
- What concepts should be reinforced before the next chapter/session?