
Ready to begin your Python journey right now?
Lesson 1: Getting Started
Objective:
-
Introduction of Coding
-
Importance of Coding in daily life with examples
-
Concept of High level and Low-Level Language
-
Language translators- Compiler and Interpreter
-
Introduction of Python Language
-
About Python- High Level Language, General Purpose Language, Interpreted and Dynamic Programming Language
-
Characteristics of python- Easy to Code, Light on Syntax, Code
readability, Open Source -
Python IDLE- Google Colab, Pycharm, Python3
-
Introduction of Print function for the output and Input function for accepting inputs from the user.
-
Create some simple programs using input and print functions
Activities:
-
Download the latest version of Python and install
-
Start up the Python Console, explain what the prompt is. Start up the
Python Shell and compare.
-
Open a Python program and run from within the Shell.
-
Create a new window in the Shell, enter a simple program (hello world), save and run.
-
Discussion: programming languages-instructions to the computer; human-readable versus computer-readable, the difference between scripting languages (such as Python) versus compiled languages (such as C or C++) which would be used to create most of the
programs the student might use on a day-to-day basis. [10 mins]
The input () function:
-
The purpose of input() function is to read input from the standard input (the keyboard, by default). It accepts all user input as a string.
-
The user may enter a number or a string but the input() function treats them as strings only.
Inputting Numeric Values:
Suppose we want to find the sum of two numbers and the program is:
num1 = input("Enter the first number: ")
num2 = input("Enter the second number: ")
sum = num1 + num2
print("The sum of ", num1, "and", num2, "is", sum)
Output:
Enter the first number: 10
Enter the second number: 20
The sum of 10 and 20 is 1020
When we execute the above program, the program doesn’t add the two numbers together; it just puts one right after the other as 1020.
The solution to the above problem is:
Python offers two functions int() and float() to be used with input ( ) to convert the values received through input ( ) into int and float types.
Accept an Integer input from User:
We need to convert an input string value into an integer using an int() function.
# Both input values are converted into integer type
num1 = int (input ("Enter first number: "))
num2 = int (input ("Enter second number: "))
sum = num1 + num2
print ('The sum of ', num1, ' and ', num2, 'is‘, sum)
OUTPUT:
Enter the first number: 10
Enter second number: 30
The sum of 10 and 30 is 40
Accept a float input from User:
We need to convert an input string value into a float using a float() function.
# Both input values are converted into float type
num1 = float (input ("Enter first number: "))
num2 = float (input ("Enter second number: "))
sum = num1 + num2
print ('The sum of', num1,'and', num2, 'is', sum)
OUTPUT:
Enter the first number: 10.5
Enter second number: 30.5
The sum of 10 and 30 is 41.0
The Print () Function
-
The print () function allows you to print out the value of a variable and strings in parenthesis.
-
The print() function will print as strings everything in a comma-separated sequence of expressions, and it will separate the results with single blanks by default.
-
The print() function prints strings in between quotes (either single or double). If a print statement has quotes around text, the computer will print it out just as it is written.
-
To print multiple items, separate them with commas. The print() function inserts a blank between objects.
-
The print() function automatically appends a newline to output. To print without a newline, use end separator after the last object.
1) The print ( ) function can be used to print a blank line.
print('Learn python from')
print() # it print a blank line in between two
print statement
print('https://www.LearningPython.com')
OUTPUT:
Learn python from
https://www.learningPython.com
2) The print() function prints the value of variable.
N1 = 20
N2 = 30
Sum = N1 + N2
print (Sum) # prints a value
The above print statement receives a variable Sum
OUTPUT:
50
3) The print () function prints the value of an expression.
N1 = 20
N2 = 30
print (N1 + N2)
# prints a value of an expression i.e., N1+N2
The above print statement prints a value of an expression.
OUTPUT:
50
4) The print () function prints two values separated with comma (,).
Ver = 3.9
lang = 'Python'
print (lang, Ver)
#prints two values separated with comma (,)
OUTPUT:
Python 3.9
5) The print () function prints a message.
N1 =20
N2 = 30
sum = N1 + N2
print ('The sum of two numbers is')
# Print statement receives a string message print
(sum)
OUTPUT:
The sum of two numbers is 50
6) The print () function prints a value, message or both message and values and vice versa.
N1 = 20
N2 = 30
Sum = N1 + N2
print ('The sum of two numbers is', Sum)
# Print is alternate way
print (Sum, "is the sum of", N1, "and", N2)
Programs/ Projects:
-
Write a Python program to display your Name and age.
-
Write a Python program to calculate the area of a Square.
-
Write a Python program to calculate your age after 10 years.
Lesson 2: 'Things' in Python
Objective:
-
Understand the use of variables to ‘store’ things - difference between a slot in memory used to hold the actual value, and a variable being a label ‘pointing’ at the value.
-
Understand the rules and conventions to declare any variable.
-
Understand the difference between a number and a string.
-
Introduction of token - Keywords, Identifiers, Literals and Operators.
-
Introduction of Mad Lib Game-Mad Lib is a game in which you write a story with missing words in it; then, you can ask another player to fill in the blanks.
-
Students will learn the use of variables, their declaration which enable them to use input and output functions in developing Mad Lib Game Project.
Activities:
-
Brief review of prior lesson. Opening the IDLE and running any previous program.
-
Students create a program to store a number in a variable and then print out the number. Discussion: what would we use variables for? Why do programs need variables?
-
Intro of type () function to determine the type of a variable.
a=10
type(a) -
What about storing a sentence in a variable? Have the student try to create a variable containing a silly sentence. After the error message is displayed, discuss the difference
between strings and numbers. Create different variables with strings and numbers. -
Introduction of Mad Lib Game Project: The main objective of this project is to build a mad lib
game by just using core python knowledge. Here in this project, we will allow users to input specific words like a noun, adverb, verb, food, animal, adjective, etc., based on the given requirement. And using all the user’s inputs, a
story will be generated using python.
Programs/Project
An example MadLib Project:
To get you inspired, here’s a quick little story:
It was pizza day at school, and Jamie was super excited for lunch. But when she went outside to eat, a bird stole her pizza! Jamie chased the bird all over school. She climbed, jumped, and ran through the playground. Then she tripped on her shoelace and the bird escaped! Luckily, Jamie’s friends were willing to share their pizza with her.
On its own, the story isn’t super exciting. But let’s see what happens when we convert it into a MadLibs game:
It was ___(FOOD1)___ day at school, and ___(NAME1)___ was super ___(ADJECTIVE)___ for lunch. But when she went outside to eat, a ___(NOUN1)___ stole her ___(FOOD2)___! ___(NAME2)___ chased the ___(NOUN2)___ all over school. She ___(VERB1)___, ___(VERB2)___, and ___(VERB3)___ through the playground. Then she tripped on her ___(NOUN3)___ and the ___(NOUN4)___ escaped! Luckily, ___(NAME2)___’s
friends were willing to share their ___(FOOD3)___ with her.
Lesson3: Operators and
Operator Precedence
Objective:
-
Understand functioning of different types of operators available in Python Programming Language.
-
Understand the working of Arithmetic Operators
(+ , - , * , / , % , // ,**). -
Understand the Relational Operators for comparisons (<, <= , > , >= , == , !=).
-
Understand Logical Operators (Not, AND, OR)
-
Understanding True and False, Combining True and False statements.
-
Understand the concept of Boolean data type (True and false).
Activities:
-
Brief review of prior lesson: Variables, numbers and strings & data types.
-
Arithmetic/Mathematical Operators
3. Relational Operators
Relational operator compares the values of the operands on its either side and determines the relationship among them in terms of True or False.
4. Logical Operators
Used to combine conditions
There are three logical operators supported by Python. These operators (and, or not) are to be written in lower case only. The logical operator evaluates to either True or False based on the logical operands on its either side.
5. Explain the idea of making Arithmetic Calculator
using Input and output functions.
Programs/Project
Exercise #1:
Find out the Output if a=6 and b=7
-
a == 6
-
a < 5.9
-
a > 5.9+1
-
b/6
-
b//6
-
b%4
-
b*2
-
b**2
Exercise #2:
Evaluate the following expressions involving relational and logical operators.
-
‘hi’ > ‘hello’ and ‘bye’ < ‘Bye’
-
7 > 8 or 5 < 6 and ‘I am fine’ > ‘I am not fine’
-
10!=9 and 29> = 29
Project:
Develop an Interactive project on Arithmetic Calculator.



Lesson 4: Assignment Operators
and Membership Operator
Objective:
-
Understand functioning of Assignment operators (+=, -=, *=, /=, %=, //=, **=).
-
Understand the working of Membership Operators (in, not in).
-
Understand the significance of Operator Precedence to solve the mathematical expressions.
-
Understand the use of eval() function and its purpose.
-
A Quiz or an assignment could be use to assess the skills or understanding of kids.
-
Revision of Data Types and Operators.
Activities:
-
Python Assignment operators are one of the operator types and assign values to variables. We use arithmetic operators here in combination with a variable.
-
+= a+=b gives the same result with: a=a+
-
-= Same idea as above but for subtraction. a-=b gives: a=a-b
These are the same idea as += and -=.
-
*= a*=b instead of a=a*b
-
/= a/=b instead of a=a/b
-
%= a%=b instead of a=a%b
-
//= a//=b instead of a=a//b
-
**= a**=b instead of a=a**b
Membership Operators- Membership operator
is used to check if a value is a member of the
given sequence or not.
-
in Will return True if an object is in another object.
-
not in Will return True if an object is not in another object.
A = "apple" A = "apple"
'e' in A 'd' not in A
True True
Programs/Project
Exercise #1:
For the following questions, write T for True or F for False:
-
____: You can add an int and a float.
-
____: You can multiply two strings.
-
____: You can subtract a float from an int.
-
____: Python multiplication is represented by the symbol “x”.
-
____: The output of the code: print (2 + “2”) is 4.
-
____: If you multiply an int and a float, the result will be a float.
Exercise #2:
Draw a line to match the examples to their corresponding data types:
-
123456789
-
“Is a hot dog a taco?” ● Integer (int)
-
98765432.1 ● Float (float)
-
“122333.4444” ● String (string)
-
0.000000001
Critical Thinking Questions:
-
What is the value of the following line of code? print((16//3)*3+(16%3))
-
Predict the values of 17%3 and 18%3 without using your computer.
-
Find out Output of the following code without using computer.
a) x=8 b) a=5
y=2 b=10
x += y a += a+b
y -= x b *= a+b
print(x,y) print(a,b)
-
Lesson 5: Programming
Methodology
Objective:
-
Understand Problem Solving approach of a programmer.
-
Defining the problem - Understanding / Analyzing problem
-
Planning the solution
-
Coding the program
-
Testing the program
-
Documenting the program
-
-
Understand Programming Methodology and its significance.
-
Understand the significance of Algorithm and Flowchart in programming.
-
Learn writing Algorithm and draw flowchart for better understanding of problem using simple programs.
-
Understand the symbols and their usage in drawing Flowchart of any problem given.
Activities:
An Algorithm is a precise step-by-step set of instructions for solving a problem or carrying out a task.
Flowchart is a graphical method of showing the flow of information using a series of symbols and arrows
Example:- Print Hello World 10 times
Algorithm:
-
Initialize count = 0 (PROCESS)
-
Print Hello World (I/O)
-
Increment count by 1 (PROCESS)
-
Is count < 10 (DECISION)
-
if YES go to step 2
-
else Stop
Flowchart:
Programs/Project
Problem #1:
Calculate area and perimeter of a Square
n1=int(input("Enter length of a square: "))
ar=n1*n1
pe=4*n1
print('The area of a square having length ',n1," is = ", ar)
print("The perimeter of a square having length ",n1, "is = ",pe)
Problem #2:
Calculate area and perimeter of a rectangle
L=int(input("Enter length of a rectangle: "))
B=int(input("Enter breadth of a rectangle: "))
ar=L*B
pe=2*(L+B)
print('The area of a rectangle having length ',L," and Breadth",B," is = ", ar)
print("The perimeter of a rectangle having length ",L,"and Breadth",B, "is = ",pe)
Problem #3:
Calculate Simple Interest
P=int(input("Enter Principal: "))
R=int(input("Enter Rate of Interest: "))
T=int(input("Enter time: "))
I=(P*R*T)/100
print("Simple Interest is =",I)
Note: Students need to draw a flowchart and write algorithm for above problems.
Critical Thinking Project:
Write a Python Program to swap values of two variables (Using and without using third variable)

Lesson 6: Control Structures –
Conditional Statements - I
Objective:
-
Understand the use of variables to ‘store’ things - difference between a slot in memory used to hold the actual value, and a variable being a label ‘pointing’ at the value.
-
Understand the rules and conventions to declare any variable.
-
Understand the difference between a number and a string.
-
Introduction of token - Keywords, Identifiers, Literals and Operators.
-
Introduction of Mad Lib Game-Mad Lib is a game in which you write a story with missing words in it; then, you can ask another player to fill in the blanks.
-
Students will learn the use of variables, their declaration which enable them to use input and output functions in developing Mad Lib Game Project.
Activities:
-
Brief review of prior lesson. Opening the IDLE and running any previous program.
-
Students create a program to store a number in a variable and then print out the number. Discussion: what would we use variables for? Why do programs need variables?
-
Intro of type () function to determine the type of a variable.
a=10
type(a) -
What about storing a sentence in a variable? Have the student try to create a variable containing a silly sentence. After the error message is displayed, discuss the difference
between strings and numbers. Create different variables with strings and numbers. -
Introduction of Mad Lib Game Project: The main objective of this project is to build a mad lib
game by just using core python knowledge. Here in this project, we will allow users to input specific words like a noun, adverb, verb, food, animal, adjective, etc., based on the given requirement. And using all the user’s inputs, a
story will be generated using python.
Programs/Project
An example MadLib Project:
To get you inspired, here’s a quick little story:
It was pizza day at school, and Jamie was super excited for lunch. But when she went outside to eat, a bird stole her pizza! Jamie chased the bird all over school. She climbed, jumped, and ran through the playground. Then she tripped on her shoelace and the bird escaped! Luckily, Jamie’s friends were willing to share their pizza with her.
On its own, the story isn’t super exciting. But let’s see what happens when we convert it into a MadLibs game:
It was ___(FOOD1)___ day at school, and ___(NAME1)___ was super ___(ADJECTIVE)___ for lunch. But when she went outside to eat, a ___(NOUN1)___ stole her ___(FOOD2)___! ___(NAME2)___ chased the ___(NOUN2)___ all over school. She ___(VERB1)___, ___(VERB2)___, and ___(VERB3)___ through the playground. Then she tripped on her ___(NOUN3)___ and the ___(NOUN4)___ escaped! Luckily, ___(NAME2)___’s
friends were willing to share their ___(FOOD3)___ with her.
Lesson 7: Control Structures –
Conditional Statements - II
Objective:
-
Understand the use of Conditional Constructs in programming.
-
Introduction of if …elif …else statement.
-
Understand the syntax and significance of if-elif-else statement when multiple conditions are given.
-
Enable student to write if-elif-else statements successfully using short and simple programs in python.
Activities:
-
Syntax
if condition_1:
statement_block_1
elif condition_2:
statement_block_2
...
elif another_condition:
another_statement_block
else:
else_block
2. Example
m= int (input ("enter marks"))
if m>90:
print ("A")
elif m>80:
print ("B")
elif m>70:
print ("C")
else:
print ("D")
Programs/Project Continued:
Project #1:
Check whether a number is positive, negative,
or zero:
number = int (input ("Enter a number: "))
if number > 0:
print ("Number is positive")
elif number < 0:
print ("Number is negative")
else:
print ("Number is zero")
Project #2:
Read in three float numbers in the following program and will print out the largest value:
x = float(input("1st Number: "))
y = float(input("2nd Number: "))
z = float(input("3rd Number: "))
if x > y and x > z:
max = x
elif y > x and y > z:
max = y
else:
max = z
print(f "The maximal value is: {max}”)
Critical Thinking Project:
Project 1:
A leap year is a calendar year containing an additional day added to keep the calendar year synchronized with the astronomical or seasonal year. In the Gregorian calendar, each leap year has 366 days instead of 365, by extending February to 29 days rather than the common 28. These extra days
occur in years which are multiples of four (with the exception of centennial years not divisible by 400). Write a Python program, which asks for a year and
calculates, if this year is a leap year or not.
Project 2:
You are driving a little too fast and the police officer stops you and issues a ticket. Write code to compute the result, encoded as an integer value: 0=no ticket, 1=small ticket, 2=big ticket. If speed is 60 or less, the result is 0. If speed is between 61 and 80 inclusive, the result is 1.
If speed is 81 or more, the result is 2. Unless it is your birthday, on that day, your speed can be 5higher in all cases. WAP to model above scenario.
Lesson 8: Control Structures –
Conditional Statements - II
Objective:
-
Understand the significance and concept of Nested if statements in programming.
-
Understand when If statements dependent on other ifs.
-
Understand the process called nesting and enables the students to make complex decisions based on different inputs.
-
Enable student to write Nested if statements successfully using short and simple programs in python.
Activities:
Nested if-else statements are nested inside other if statements. That is, a nested if statement is the body of another if statement. We use nested if statements
when we need to check secondary conditions only if the first condition executes as true.
-
Syntax
if condition_1:
if condition_2:
statement_block_1
else:
statement_block_2
else:
statements
2. Example
x = 41
if x > 10:
print("Above ten,")
if x > 20:
print("and also above 20!")
else:
print("but not above 20.")
Programs/Project Continued:
Project #1:
Compare age with a nested if statement:
age = 19
isGraduated = False
hasLicense = True
if age >= 18: # Look if person is 18 years or older
print("You're 18 or older. Welcome to adulthood!")
if isGraduated:
print('Congratulations with your graduation!')
if hasLicense:
print('Happy driving!')
Project #2:
Handles Product inventory using nested if:
itemsOrdered = 30
itemsInStock = 32
print("Got an order for", itemsOrdered, "items. In stock:", itemsInStock)
if itemsOrdered >= itemsInStock: # Compare order size against inventory
print("Resupply the inventory. We're running out!")
else:
packageCount = round(itemsOrdered / 8)
if packageCount > 1:
print("We need multiple packages to fulfil this order!")
Hands on Practice:
Project 1:
To check if the number is greater or less than 25. If the number is less than 25, we’ll check if it is an odd number or an even number. If the number is
greater than 25, we will print that the number is greater than 25.
Project 2: Accept the age, sex (‘M’, ‘F’), number of days and display the wages according to the following criteria:
If age does not fall in any range, then display the following message: “Enter appropriate age”

Lesson 7: Control Structures –
Conditional Statements - II
Objective:
-
Understand the use of Conditional Constructs in programming.
-
Introduction of if …elif …else statement.
-
Understand the syntax and significance of if-elif-else statement when multiple conditions are given.
-
Enable student to write if-elif-else statements successfully using short and simple programs in python.
Activities:
-
Syntax