Introduction to Python in Jupyter Notebook
Learning Module
This module introduces the basic concepts of Python programming using Jupyter Notebook (.ipynb). It is
designed for beginners who want to learn the notebook environment, write simple Python code, and practice
basic programming tasks.
Learning Objectives
1 Explain what an .ipynb file is.
2 Identify the parts of the Jupyter Notebook interface.
3 Write and run basic Python statements.
4 Use variables, data types, input, and operators.
5 Apply conditional statements and loops.
6 Create simple functions.
1. What is an IPYNB File?
An IPYNB file is a Jupyter Notebook file. It contains markdown cells for text, code cells for executable Python
code, and outputs such as text, tables, and graphs. Jupyter Notebook is widely used in learning, research,
and data analysis because it combines discussion and execution in a single document.
2. Your First Python Code
Example:
print("Hello, world!")
3. Variables and Data Types
Variables store information. Common data types include int for whole numbers, float for decimal numbers, str
for text, and bool for true or false values.
4. Arithmetic Operators
Python uses operators such as +, -, *, /, %, and ** for mathematical computations.
5. User Input
The input() function allows the user to enter data during program execution.
6. Conditional Statements
Conditional statements such as if, elif, and else allow programs to make decisions based on conditions.
7. Loops
Loops such as for and while allow repeated execution of a block of code.
8. Functions
Functions are reusable blocks of code that perform a specific task. They help organize programs and reduce
repetition.
9. Practice Activities
1 Create a variable for your course and print it.
2 Add two numbers and display the result.
3 Write an if-else statement that checks if a number is even or odd.
4 Use a for loop to print numbers from 1 to 10.
5 Create a function that returns the square of a number.
10. Reflection Questions
1 What is the purpose of a code cell in Jupyter Notebook?
2 What is the difference between = and == in Python?
3 Why are functions useful in programming?
Assessment
Identification: Define the following terms:
1 Jupyter Notebook
2 Variable
3 Data type
4 Loop
5 Function
Short Exercise: Write a Python program that asks for the user's name and age, then prints a message using
those values.
Summary
This learning module presented the basic structure of an IPYNB file and the essential Python concepts that
beginners should learn first. By practicing in Jupyter Notebook, learners can read explanations and test code
in the same environment, making programming easier to understand.