0% found this document useful (0 votes)
4 views4 pages

Python Modules 1 To 5 Notes

The document provides an overview of Python programming for beginners, covering key concepts such as programming languages, algorithms, and the structure of a Python program. It includes modules on variables, user input, and basic arithmetic operations, emphasizing Python's ease of use and syntax rules. Examples are provided to illustrate how to write and execute simple Python code.

Uploaded by

nechemanuel101
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

Python Modules 1 To 5 Notes

The document provides an overview of Python programming for beginners, covering key concepts such as programming languages, algorithms, and the structure of a Python program. It includes modules on variables, user input, and basic arithmetic operations, emphasizing Python's ease of use and syntax rules. Examples are provided to illustrate how to write and execute simple Python code.

Uploaded by

nechemanuel101
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

PYTHON PROGRAMMING NOTES (JSS1 – JSS3 Combined)

MODULE 1: Introduction to Programming


Programming is the process of giving instructions to a computer so that it can perform
tasks.

A computer cannot think by itself. It only follows instructions given by humans.

A programming language is a special language used to communicate with computers.

Examples include Python, Java, C++, JavaScript and Scratch.

Python is a popular programming language that is easy to learn. It is used around the world

for building websites, games, data analysis, artificial intelligence and automation.

Instruction: A command given to a computer to perform a task.

Algorithm: A step-by-step method used to solve a problem.

Example Algorithm – Preparing to go to school:

1. Wake up

2. Take a bath

3. Wear school uniform

4. Eat breakfast

5. Pack school bag

6. Go to school

MODULE 2: First Python Program


A Python program is a set of instructions written in the Python language.

Python executes instructions from top to bottom.


The print() function is used to display output on the screen.

Example:

print("Hello World")

Output:

Hello World

More examples:

print("My name is David")

print("I am learning Python")

print("Welcome to Computer Class")

Important Python rules (Syntax):

1. Python is case sensitive (print is not the same as Print).

2. Quotation marks must be closed.

3. Brackets must also be closed properly.

MODULE 3: Variables
A variable is a container used to store information in a program.

Example:

name = "John"

age = 13

Variables allow programs to remember information and use it later.


Example:

name = "Mary"

print(name)

Variable naming rules:

1. Variables should not start with numbers.

2. Variables should not contain spaces.

3. Use meaningful names such as student_name, age, score.

MODULE 4: User Input


Input refers to information entered by the user into a program.

Python uses the input() function to collect data from users.

Example:

name = input("Enter your name: ")

print("Welcome", name)

Another example:

age = input("Enter your age: ")

print("You are", age, "years old")

Input allows programs to interact with users and collect useful information.

MODULE 5: Numbers and Calculations


Python can perform mathematical calculations using arithmetic operators.

Common operators:
+ Addition

- Subtraction

* Multiplication

/ Division

Example:

a = 10

b=5

print(a + b)

print(a - b)

print(a * b)

print(a / b)

Using input with numbers:

num1 = int(input("Enter first number: "))

num2 = int(input("Enter second number: "))

print(num1 + num2)

This allows users to enter numbers and the program calculates the result.

You might also like