Hiring Partners
Segilola Resources Operating LimitedTaviatech TechnologiesFCMBMTN NigeriaAdvans La Fayette Microfinance BankAboki AfricaFirst Bank of NigeriaOPay
โ† PYTHON FUNDAMENTALS LEVEL 1 PROFESSIONAL ยท Lesson 3 of 9

Module Two

๐Ÿ“– Every lesson in this course is free to read right here, no account needed. Create a free account to track your progress, take the exam, and earn your certificate.
3
Module 2: Installing Python and Writing Your First Program**

Module 2: Installing Python and Writing Your First Program

Welcome to Module 2 of Python Fundamentals Level 1 Professional! In the previous module, you learned what programming is, what Python means, and how Python is used in the real world.

In this module, you will learn how to prepare your computer for Python programming, install Python, understand the tools used to write code, and create your first Python program.

Learning Objectives

By the end of this module, you should be able to:

  • Explain what Python installation means.
  • Identify the basic requirements for installing Python.
  • Download Python from its official website.
  • Install Python on a Windows computer.
  • Understand what a code editor and IDE are.
  • Open Python and run simple instructions.
  • Create and save your first Python program.
  • Recognise and correct simple programming errors.

1. What Does Installing Python Mean?

Installing Python means adding the Python software to your computer so that you can write and run Python programs.

Think about installing WhatsApp on your phone. Before you can use the application, you must download and install it. Python works in a similar way. You need to install it before you can run Python programs directly on your computer.

Once Python is installed, your computer can understand and execute instructions written using the Python programming language.

2. What Do You Need Before Installing Python?

You do not need an expensive computer to start learning Python. A normal computer that can run a supported operating system is usually enough for beginner programming.

Basic Requirements

  • A desktop computer or laptop.
  • A supported operating system such as Windows, macOS or Linux.
  • An internet connection for downloading Python.
  • Enough storage space for the installation.
  • A keyboard for typing your code.
  • A code editor or Python development environment.

You can also practise Python using online coding environments without installing it on your computer.

3. Downloading Python

The safest place to download Python is its official website. Avoid downloading programming software from unknown websites.

Visit the official Python website: https://www.python.org/downloads/

Steps to Download Python

  1. Open your web browser, such as Chrome, Edge or Firefox.
  2. Visit the official Python downloads page.
  3. Choose the download option recommended for your operating system.
  4. Wait for the installation file to download.
  5. Locate the downloaded file on your computer.

Important: Download a currently supported Python release that is compatible with your operating system.

4. Installing Python on Windows

Many learners use Windows computers. Follow these steps to install Python on a Windows laptop or desktop.

Step 1: Open the Downloaded File

Locate the Python installation file in your Downloads folder. Double-click the file to start the installation.

Step 2: Select the PATH Option

During installation, look for an option labelled: Add Python to PATH.

Select this option before continuing. It helps Windows find Python when you run Python commands from the command line.

Step 3: Install Python

Select the installation option, such as Install Now, and allow the installation process to finish.

Step 4: Complete the Installation

When the installation is successful, close the installer. Python is now ready for you to test.

5. How to Check Whether Python Is Installed

After installing Python, you should confirm that it works correctly. You can do this using the Windows Command Prompt.

Steps

  1. Press the Windows key on your keyboard.
  2. Type cmd into the search box.
  3. Open Command Prompt.
  4. Type the command below and press Enter.
python --version

If Python is installed and available through PATH, your computer should display the installed Python version.

For example:

Python 3.x.x

The exact version number depends on the version you installed. On some Windows computers, you may need to use:

py --version

If neither command works, check whether Python was installed correctly and whether the PATH option was selected.

6. What Is a Code Editor?

A code editor is a software application that helps programmers write and edit computer instructions.

Think of a code editor as a digital notebook. Instead of writing stories or school notes, you use it to write programming code.

Examples of Code Editors and Development Tools

6.1 Visual Studio Code

Visual Studio Code (VS Code) is a popular code editor used by programmers. It supports Python through extensions and provides features that make writing and managing code easier.

Official website: https://code.visualstudio.com/

6.2 IDLE

IDLE is a basic development environment that comes with many standard Python installations. It allows beginners to write and run Python code.

6.3 PyCharm

PyCharm is a development environment designed for Python programming. It provides tools for writing, testing and managing larger Python projects.

6.4 Online Python Editors

Online Python editors allow you to write and run Python code through a web browser. They are useful when you cannot install Python on your computer.

Examples include:

7. Understanding the Python Interactive Shell

The Python interactive shell is a place where you can type Python instructions and see the results immediately.

When you open the Python interactive shell, you may see three greater-than symbols:

>>

These symbols are called the Python prompt. They show that Python is ready to receive an instruction.

Example

>>> print("Hello, World!")
Hello, World!

Python executes the instruction and displays the message. You can also use the interactive shell to perform calculations.

>>> 10 + 5
15

>>> 20 * 3
60

The interactive shell is useful for testing small pieces of code before adding them to a complete program.

8. Writing Your First Python Program

It is time to write your first Python program! Programmers often begin with a simple program called Hello, World!

This program displays a welcome message on the computer screen.

Step 1: Open Your Python Editor

Open IDLE, Visual Studio Code or another Python editor.

Step 2: Create a New File

Create a new file where you can write your Python instructions.

Step 3: Type This Code

print("Hello, World!")

Step 4: Save Your File

Save the file with the name:

hello.py

The .py extension tells your computer that the file contains Python code.

Step 5: Run Your Program

Use the Run option in your editor or run the saved file from the command line.

For example, in Command Prompt, navigate to the folder containing the file and enter:

python hello.py

Your program should display:

Hello, World!

Congratulations! You have successfully created your first Python program.

9. Understanding the print() Function

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

A function is a reusable instruction that performs a particular task. You will learn more about functions in a later module.

Example 1: Displaying Your Name

print("My name is Amina")

Output:

My name is Amina

Example 2: Displaying Your School

print("I am a student")

Output:

I am a student

Example 3: Displaying a Number

print(2026)

Output:

2026

Notice that text is normally placed inside quotation marks, while a number can be written without quotation marks.

10. Writing Multiple Instructions

A Python program can contain several instructions. Python normally executes them one after another, from top to bottom.

Example

print("Welcome to CRMNuggets")
print("Learn Python Programming")
print("Practise every day")
print("Become a better programmer")

Output:

Welcome to CRMNuggets
Learn Python Programming
Practise every day
Become a better programmer

Each print() instruction displays a new line of information.

11. Understanding Comments in Python

A comment is a note written inside a program to explain what a particular section of code does.

Python ignores comments when executing a program. Comments are useful because they help programmers understand their own code and explain it to other people.

Example

# This program displays a welcome message
print("Welcome to Python")

Output:

Welcome to Python

The # symbol tells Python that the rest of that line is a comment.

12. Common Errors Beginners May Encounter

Sometimes your Python program may not work as expected. This does not mean you are a bad programmer. Errors are a normal part of learning how to code.

12.1 Spelling Errors

Python instructions must be spelled correctly. For example, writing pritn() instead of print() will cause an error.

12.2 Missing Quotation Marks

Text inside print() should normally be placed inside quotation marks.

Incorrect example:

print("Hello, World!)

Correct example:

print("Hello, World!")

12.3 Missing Parentheses

Python uses parentheses in instructions such as print(). Forgetting a closing parenthesis can cause a syntax error.

12.4 Saving the File with the Wrong Extension

Python program files should normally use the .py extension.

Correct filename:

myprogram.py

13. Practical Activity: Create a Student Introduction Program

Imagine you are creating a small program for a student in a Nigerian secondary school. The program should display the student's introduction.

Your Task

Write a Python program that displays:

  • Your name.
  • Your age.
  • Your school name.
  • Your favourite subject.
  • A message saying you are learning Python.

Sample Solution

print("My name is Tunde")
print("I am 13 years old")
print("I attend Bright Future School")
print("My favourite subject is Mathematics")
print("I am learning Python")

Expected output:

My name is Tunde
I am 13 years old
I attend Bright Future School
My favourite subject is Mathematics
I am learning Python

Change the information to your own details and run the program.

14. Mini Project: Create a School Welcome Message

Imagine that your school wants a simple computer program to welcome new students.

Project Requirements

  1. Display the name of the school.
  2. Display a welcome message.
  3. Display the words "Education is the key to success".
  4. Display the words "Welcome to a new academic session".

Sample Project Code

print("BRIGHT FUTURE SECONDARY SCHOOL")
print("Welcome to our school!")
print("Education is the key to success")
print("Welcome to a new academic session")

You can replace the school name with the name of your own school.

15. Important Terms to Remember

Term Meaning
Installation Adding software to a computer so it can be used.
Python Interpreter A tool that executes Python instructions.
Code Editor Software used to write and edit programming code.
IDLE A basic development environment included with many Python installations.
Interactive Shell A place where Python instructions can be entered and executed immediately.
print() A Python function used to display information.
Comment A note in code that Python ignores during execution.
.py The common file extension used for Python programs.
Output The result displayed after a program runs.

16. Module Summary

In this module, you have learned that:

  • Python must be installed before you can run it directly on your computer.
  • You can download Python from its official website.
  • Windows users can check Python installation using Command Prompt.
  • Code editors help programmers write and manage code.
  • IDLE is a simple environment for writing Python programs.
  • The Python interactive shell allows you to test instructions immediately.
  • The print() function displays information on the screen.
  • Python files normally use the .py extension.
  • Comments help explain what code does.
  • Errors are a normal part of learning programming.

17. Knowledge Check

Answer the following questions to test your understanding.

  1. What does installing Python mean?
    • A. Deleting Python from a computer
    • B. Adding Python software to a computer
    • C. Printing a document
    • D. Opening a website
  2. Which website should you use to download Python?
    • A. python.org
    • B. facebook.com
    • C. wikipedia.org
    • D. youtube.com
  3. Which command can check the Python version on Windows?
    • A. check python
    • B. python --version
    • C. open python
    • D. version python
  4. What is a code editor used for?
    • A. Washing a computer
    • B. Writing and editing code
    • C. Playing music only
    • D. Charging a laptop
  5. Which of these is a Python development tool?
    • A. IDLE
    • B. Calculator only
    • C. Paint only
    • D. File Explorer only
  6. Which function displays information in Python?
    • A. show()
    • B. display_screen()
    • C. print()
    • D. output_text()
  7. What is the usual file extension for Python programs?
    • A. .docx
    • B. .jpg
    • C. .py
    • D. .mp3
  8. What symbol is used to begin a single-line Python comment?
    • A. @
    • B. #
    • C. $
    • D. &
  9. What does the Python interactive shell allow you to do?
    • A. Test Python instructions immediately
    • B. Repair a broken keyboard
    • C. Create a computer monitor
    • D. Install a printer
  10. Which of the following is a correct Python instruction?
    • A. print("Hello")
    • B. print Hello)
    • C. display("Hello"
    • D. show Hello

Knowledge Check Answers

Click here to reveal the correct answers
  1. B โ€” Adding Python software to a computer.
  2. A โ€” python.org.
  3. B โ€” python --version.
  4. B โ€” Writing and editing code.
  5. A โ€” IDLE.
  6. C โ€” print().
  7. C โ€” .py.
  8. B โ€” #.
  9. A โ€” Test Python instructions immediately.
  10. A โ€” print("Hello").

18. What Is Next?

Congratulations! You have completed Module 2 of Python Fundamentals Level 1 Professional.

In Module 3: Python Syntax, Comments and Indentation, you will learn the basic rules for writing Python code, how Python understands instructions, why spaces and indentation matter, and how to write clean and readable programs.

Keep practising. The more code you write, the more confident you will become!

๐Ÿ† Get Certified

๐Ÿ”’

Earn this certificate

Every lesson is already free to read. Sign up, finish the lessons, pass the exam (โ‚ฆ2,000 or 20,000 coins), and get a verified certificate with your name on it.

๐ŸŽ“ Sign Up to Get Certified
๐Ÿ› ๏ธ Practice Tools
Hands-on simulators & labs - subscription required.
โ†’
๐ŸŽฏ Internship Tasks
Real-world tasks to build your portfolio - unlock them with a subscription.
โ†’