Hiring Partners
Segilola Resources Operating LimitedTaviatech TechnologiesFCMBMTN NigeriaAdvans La Fayette Microfinance BankAboki AfricaFirst Bank of NigeriaOPay
โ† Python Fundamentals Level One ยท Lesson 2 of 5

Module One

๐Ÿ“– 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.
2
Module 1 ยท Python Programming Level 1

๐Ÿ Module One: Welcome to Python Programming โ€“ Your First Steps into Coding

1. Module Title

Module One: Welcome to Python Programming โ€“ Your First Steps into Coding


2. Module Introduction

Hello, young coder! Welcome to the wonderful world of programming. Have you ever wanted to make a computer do what you want? Have you ever wondered how video games, apps, and websites are made? The secret is programming โ€“ and Python is one of the best languages to start with.

Python is a programming language that is easy to read, easy to write, and very powerful. It is used by scientists, game developers, web builders, and even astronauts! In this first module, we will start from the very beginning. We will learn what programming is, why Python is so popular, and how to write our very first programs. We will use simple words, fun examples, and lots of practice. By the end of this module, you will be able to write your own Python programs and understand the basic building blocks of coding. Let's start your coding adventure!


3. Learning Objectives

After completing this module, you will be able to:

  • Explain what programming is and why Python is a great language.
  • Set up and use a Python development environment on your computer.
  • Write and run your very first Python program โ€“ "Hello, World!"
  • Use variables to store and work with data.
  • Understand and use different data types (numbers, text, decimals).
  • Ask the user for input and display output.
  • Make decisions with conditional statements (if and else).
  • Repeat tasks with loops (while and for).
  • Store many items in a list and work with them.
  • Write simple functions to organise your code.
  • Understand and fix errors (debugging).

4. Warm-up Story

Ada's First Code

Ada was 10 years old and loved solving puzzles. One day, her older brother showed her something amazing โ€“ a program that could greet people by name. He typed: print("Hello, Ada!") and the computer said "Hello, Ada!" Ada was amazed. She asked, "How did it do that?" Her brother said, "This is Python โ€“ a language you can use to talk to computers."

Ada wanted to learn more. She started with simple commands, then learned about variables and loops. She wrote a program that asked for her name and said "Hello" back. She was so proud! Soon, she was writing small games and solving math problems with code. Ada discovered that programming is like giving instructions to a very fast, very smart friend. And now, you can learn too!


5. Main Lessons

Lesson 1: What is Programming?

Definition: Programming is giving instructions to a computer to make it do what you want. These instructions are written in a programming language.

Why it's important: Programming lets you create games, websites, apps, and solve problems. It is like having a superpower!

Simple explanation: Programming is like writing a recipe for a robot โ€“ you tell it exactly what to do, step by step.

Real-life example: A weather app uses programming to show you the forecast.

School example: A student writes code to calculate the average of test scores.

Home example: A parent programs a smart light to turn on at sunset.

Nigerian example: A Lagos startup uses programming to build a delivery app.

Illustration:

  +--------------------------------------------------+
  |  PROGRAMMING = GIVING INSTRUCTIONS TO COMPUTER   |
  |  +----------------------------------------------+ |
  |  |  CODE: print("Hello, World!")                | |
  |  |  COMPUTER OUTPUT: Hello, World!              | |
  |  +----------------------------------------------+ |
  +--------------------------------------------------+

Mini summary: Programming is writing instructions for computers to follow.


Lesson 2: What is Python?

Definition: Python is a programming language that is easy to read and write. It is one of the most popular languages in the world.

Why it's important: Python is used in web development, data science, artificial intelligence, and more. It is a great first language to learn.

Simple explanation: Python is like a friendly language that computers understand, and it's very beginner-friendly.

Real-life example: YouTube and Instagram use Python!

School example: Many schools teach Python as the first programming language.

Home example: You can use Python to automate tasks on your computer.

Nigerian example: Nigerian developers use Python to build web apps and data tools.

Illustration:

  +--------------------------------------------------+
  |  PYTHON IS...                                     |
  |  +----------------------------------------------+ |
  |  |  โœ… Easy to read                             | |
  |  |  โœ… Fun to write                             | |
  |  |  โœ… Very powerful                            | |
  |  |  โœ… Used by big companies                    | |
  |  |  โœ… Beginner-friendly                        | |
  |  +----------------------------------------------+ |
  +--------------------------------------------------+

Mini summary: Python is a popular, easy-to-learn programming language.


Lesson 3: Setting Up Python

Definition: Setting up Python means installing it on your computer so you can write and run Python programs.

Why it's important: You need Python installed to start coding.

Simple explanation: It's like installing a game before you can play it.

Real-life example: A developer installs Python on their laptop.

School example: A student installs Python on a school computer.

Home example: A parent installs Python for their child to learn coding.

Nigerian example: A Nigerian tech student installs Python for a project.

Illustration โ€“ Installation Steps:

  1. Go to python.org
  2. Click "Download Python"
  3. Run the installer
  4. Check "Add Python to PATH"
  5. Click "Install"
  6. Verify by typing: python --version in the terminal

Mini summary: Install Python from python.org to start coding.


Lesson 4: Your First Program โ€“ Hello, World!

Definition: "Hello, World!" is the traditional first program you write in any programming language.

Why it's important: It verifies that everything is set up correctly and introduces you to the basic structure of a program.

Simple explanation: It's like saying "hello" to the computer to make sure it's listening.

Real-life example: Every programmer starts with Hello, World!

School example: A student writes their first Hello, World! program.

Home example: A parent helps their child write their first code.

Nigerian example: A coding beginner in Lagos writes Hello, World!

Illustration โ€“ Code:

  print("Hello, World!")

Mini summary: "Hello, World!" is the first program every coder writes.


Lesson 5: Variables โ€“ Storing Information

Definition: A variable is like a box where you can store information. You give it a name and put a value inside.

Why it's important: Variables let you save data and use it later.

Simple explanation: A variable is like a labelled jar โ€“ you put something in and you can take it out later.

Real-life example: name = "Chidi" stores the name "Chidi" in the variable called name.

School example: score = 85 stores the number 85 in the variable score.

Home example: age = 10 stores your age.

Nigerian example: city = "Lagos" stores "Lagos" in the variable city.

Illustration โ€“ Code:

  name = "Ada"
  age = 10
  print(name)
  print(age)

Mini summary: Variables store information for later use.


Lesson 6: Data Types โ€“ Numbers and Text

Definition: Data types tell Python what kind of data a variable holds. The most common are integers (whole numbers), floats (decimal numbers), and strings (text).

Why it's important: Different data types are used differently โ€“ you can do math with numbers, but not with text.

Simple explanation: Data types are like different kinds of toys โ€“ you play with each one differently.

Real-life example: age = 10 (integer) vs name = "Ada" (string).

School example: score = 90 (integer) and subject = "Maths" (string).

Home example: temperature = 28 (integer) and weather = "sunny" (string).

Nigerian example: price = 5000 (integer) and currency = "Naira" (string).

Illustration โ€“ Code:

  age = 10        # This is an integer (whole number)
  price = 2500.50 # This is a float (decimal number)
  name = "Ada"    # This is a string (text)
  city = "Lagos"  # This is a string

Mini summary: Integers are whole numbers, floats are decimals, and strings are text.


Lesson 7: Getting User Input

Definition: User input lets you ask the user to type something, and your program can use that information.

Why it's important: It makes your program interactive!

Simple explanation: It's like asking a friend a question and using their answer.

Real-life example: A program asks for your name and greets you.

School example: A quiz program asks for the user's answer.

Home example: A recipe program asks how many people you are cooking for.

Nigerian example: A bank app asks for your PIN.

Illustration โ€“ Code:

  name = input("What is your name? ")
  print("Hello, " + name + "!")

Mini summary: input() lets you ask the user for information.


Lesson 8: Conditional Statements โ€“ Making Decisions (if, else)

Definition: Conditional statements let your program make decisions. if checks a condition, and else runs if the condition is false.

Why it's important: They let your program respond differently to different situations.

Simple explanation: It's like saying "If it's raining, take an umbrella; otherwise, wear sunglasses."

Real-life example: If a user enters the correct password, let them in; otherwise, say "Wrong password!"

School example: If a test score is above 50, print "Pass"; otherwise, print "Fail".

Home example: If it's cold, wear a jacket; otherwise, wear a t-shirt.

Nigerian example: If the price is above โ‚ฆ10,000, print "Expensive"; otherwise, print "Cheap".

Illustration โ€“ Code:

  age = int(input("How old are you? "))
  if age >= 18:
      print("You are an adult.")
  else:
      print("You are a child.")

Mini summary: if and else help your program make decisions.


Lesson 9: Loops โ€“ Repeating Code (while loop)

Definition: A while loop repeats a block of code as long as a condition is true.

Why it's important: It lets you repeat tasks without writing the same code over and over.

Simple explanation: It's like a song that repeats until you tell it to stop.

Real-life example: A game continues as long as the player has lives left.

School example: A program asks for a password until the correct one is entered.

Home example: A timer that counts down until it reaches zero.

Nigerian example: A POS machine asks for your PIN until it's correct.

Illustration โ€“ Code:

  count = 0
  while count < 5:
      print("Count is: " + str(count))
      count = count + 1

Mini summary: while loops repeat code as long as a condition is true.


Lesson 10: Loops โ€“ Repeating Code (for loop)

Definition: A for loop repeats code a set number of times โ€“ like going through a list.

Why it's important: It's used when you know how many times you want to repeat.

Simple explanation: It's like counting from 1 to 10.

Real-life example: A program prints each item in a shopping list.

School example: A program adds up numbers from 1 to 100.

Home example: A program prints the days of the week.

Nigerian example: A program lists all the states in Nigeria.

Illustration โ€“ Code:

  for number in range(1, 6):
      print(number)

Mini summary: for loops repeat code a specific number of times.


Lesson 11: Lists โ€“ Storing Many Items

Definition: A list is a collection of items. You can store multiple values in one variable.

Why it's important: Lists help you organise and manage multiple pieces of data.

Simple explanation: A list is like a basket with many fruits โ€“ you can put lots of things in one basket.

Real-life example: fruits = ["Mango", "Orange", "Banana"]

School example: scores = [85, 90, 78, 92]

Home example: shopping = ["Milk", "Bread", "Eggs"]

Nigerian example: states = ["Lagos", "Abuja", "Kano"]

Illustration โ€“ Code:

  fruits = ["Mango", "Orange", "Banana"]
  print(fruits[0])  # Prints "Mango"
  print(fruits[1])  # Prints "Orange"

Mini summary: Lists store multiple items in one variable.


Lesson 12: Functions โ€“ Reusable Code Blocks

Definition: A function is a block of code that you can reuse. You define it once and call it whenever you need it.

Why it's important: Functions help you organise your code and avoid repetition.

Simple explanation: A function is like a recipe โ€“ you write it once and can use it many times.

Real-life example: A function that calculates the area of a rectangle.

School example: A function that greets a user by name.

Home example: A function that converts temperature from Celsius to Fahrenheit.

Nigerian example: A function that converts Naira to Dollars.

Illustration โ€“ Code:

  def greet(name):
      print("Hello, " + name + "!")

  greet("Ada")   # Prints: Hello, Ada!
  greet("Chidi") # Prints: Hello, Chidi!

Mini summary: Functions are reusable code blocks.


Lesson 13: Comments โ€“ Explaining Your Code

Definition: Comments are notes in your code that Python ignores. They help you (and others) understand what your code does.

Why it's important: Comments make your code easier to read and understand.

Simple explanation: Comments are like sticky notes you leave for yourself.

Real-life example: # This line prints a greeting

School example: # Calculate the average score

Home example: # Convert temperature

Nigerian example: # This function calculates tax

Illustration โ€“ Code:

  # This is a comment
  print("Hello, World!")  # This prints a message

Mini summary: Comments are notes to explain your code.


Lesson 14: Debugging โ€“ Fixing Errors

Definition: Debugging is the process of finding and fixing errors in your code.

Why it's important: Every programmer makes mistakes โ€“ debugging helps you fix them.

Simple explanation: Debugging is like being a detective and finding clues to solve a mystery.

Real-life example: A programmer fixes a typo in their code.

School example: A student fixes a syntax error in their program.

Home example: A parent finds a missing colon in their code.

Nigerian example: A developer fixes a bug in a banking app.

Illustration โ€“ Common Errors:

  # Syntax Error: Missing colon
  if age >= 18
      print("Adult")  # Error! Missing colon after 18

  # Name Error: Variable not defined
  print(score)  # Error! score is not defined

  # Type Error: Wrong data type
  print("Your age is " + age)  # Error! age is an integer, not a string

Mini summary: Debugging is finding and fixing errors.


Lesson 15: Review โ€“ What We Learned in Module One

In this module, we learned:

  • What programming is and why Python is a great language.
  • How to set up Python and write a "Hello, World!" program.
  • How to use variables to store data.
  • Data types (integers, floats, strings).
  • How to get user input with input().
  • Conditional statements (if/else) to make decisions.
  • Loops (while and for) to repeat code.
  • Lists to store multiple items.
  • Functions to reuse code.
  • Comments and debugging.

You are now ready to continue your Python journey!


6. Key Vocabulary

  • Programming: Writing instructions for computers.
  • Python: A popular programming language.
  • Variable: A container for storing data.
  • Integer: A whole number (e.g., 10, 25).
  • Float: A decimal number (e.g., 3.14, 2.5).
  • String: A piece of text (e.g., "Hello").
  • Input: Data given to a program by the user.
  • Output: Data displayed by a program.
  • Conditional: A statement that makes a decision (if/else).
  • Loop: Code that repeats.
  • List: A collection of items.
  • Function: A reusable block of code.
  • Comment: A note in the code.
  • Debugging: Fixing errors.

7. Important Concepts

  • Code is read by humans too: Write clean, understandable code with comments.
  • Practice is key: The more you code, the better you become.
  • Errors are okay: Every programmer makes mistakes โ€“ debugging is part of the process.
  • Start small: Build simple programs first and gradually add more features.
  • Have fun: Coding should be enjoyable!

8. Step-by-step Explanations

How to write and run a Python program:

  1. Open your code editor (like IDLE, VS Code, or any text editor).
  2. Type your Python code.
  3. Save the file with a .py extension (e.g., hello.py).
  4. Open a terminal or command prompt.
  5. Navigate to the folder where you saved the file.
  6. Type python filename.py and press Enter.
  7. See the output and debug if needed.

9. Real-life Examples

  • A program that calculates your age based on your birth year.
  • A program that converts currency.
  • A program that checks if a number is even or odd.
  • A program that asks for your name and greets you.
  • A program that calculates the total price of items.

10. Nigerian Examples

  • A program that converts Naira to Dollars.
  • A program that lists all the states in Nigeria.
  • A program that calculates the total cost of items in a Lagos market.
  • A program that checks if someone is eligible to vote in Nigeria.
  • A program that greets you in Yoruba, Hausa, or Igbo.

11. Fun Examples Children Can Relate To

  • A program that asks for your favourite cartoon and says "I like that too!"
  • A program that counts down from 10 to 1 and says "Blast off!"
  • A program that asks for your age and says "You are X years old!"
  • A program that stores your favourite foods in a list and prints them.
  • A program that tells a joke.

12. Everyday Examples

  • ๐Ÿ“ฑ A calculator app.
  • ๐Ÿ“ A to-do list manager.
  • ๐Ÿ“… A birthday reminder.
  • ๐Ÿ›’ A shopping list.
  • ๐Ÿ“Š A grade calculator.

13. Teacher Notes

Start with simple examples and gradually increase complexity. Encourage students to type code themselves, not just copy. Use pair programming โ€“ let students work together. Celebrate small successes. Use Nigerian examples to make learning relatable. Emphasise that errors are a natural part of learning.


14. Parent Tips

Help your child set up Python. Sit with them as they write their first programs. Ask questions like "What do you think this code does?" and "What happens if you change this number?" Encourage curiosity and experimentation. Celebrate their progress and don't worry about mistakes โ€“ they are learning!


15. Interesting Facts

  • ๐Ÿ Python was named after the TV show Monty Python's Flying Circus, not the snake!
  • ๐Ÿ“Š Python is used by Google, NASA, and Instagram.
  • ๐ŸŽฎ Many popular games use Python for scripting.
  • ๐Ÿ’ก Python was created by Guido van Rossum in 1991.
  • ๐ŸŒ Python is one of the most popular languages in the world.

16. Did You Know?

  • Python is used by data scientists to analyse large amounts of data.
  • Python can be used to create artificial intelligence and machine learning models.
  • Python is a great first language because it reads like English.
  • You can build websites with Python using frameworks like Django and Flask.
  • Python is used by Nigerian tech companies and startups.

17. Remember This

  • โœ… Python is a programming language.
  • โœ… Variables store data.
  • โœ… Strings are text, integers are whole numbers, floats are decimals.
  • โœ… input() gets user input.
  • โœ… if/else makes decisions.
  • โœ… Loops repeat code.
  • โœ… Lists store multiple items.
  • โœ… Functions reuse code.
  • โœ… Comments explain code.
  • โœ… Debugging fixes errors.

18. Common Mistakes

  • โŒ Forgetting colons : after if, else, while, and for.
  • โŒ Forgetting to indent code (Python uses indentation).
  • โŒ Mixing data types โ€“ e.g., adding a string to an integer.
  • โŒ Using = for comparison instead of ==.
  • โŒ Not closing parentheses or quotes.

19. Best Practices

  • โœ… Use meaningful variable names (e.g., age, name).
  • โœ… Add comments to explain your code.
  • โœ… Use consistent indentation (4 spaces is standard).
  • โœ… Test your code frequently.
  • โœ… Start small and add features gradually.

20. Illustrations

Python Setup Flowchart

  +-------------+     +-------------+     +-------------+     +-------------+
  |  GO TO      | --> |  DOWNLOAD   | --> |  RUN        | --> |  TEST WITH  |
  |  PYTHON.ORG |     |  INSTALLER  |     |  INSTALLER  |     |  "python --version" |
  +-------------+     +-------------+     +-------------+     +-------------+

Comparison Table โ€“ Data Types

Data TypeWhat It IsExample
IntegerWhole number10, 25, 100
FloatDecimal number3.14, 2.5, 0.99
StringText"Hello", "Ada", "Lagos"
BooleanTrue/FalseTrue, False
ListCollection of items[1, 2, 3]

Comparison Table โ€“ Loops

Loop TypeWhen to UseExample
whileWhen you don't know how many timeswhile count < 5:
forWhen you know how many timesfor i in range(5):

Comparison Table โ€“ Conditional Statements

StatementWhen it RunsExample
ifWhen condition is trueif age >= 18:
elseWhen condition is falseelse:
elifWhen first condition is false and another is trueelif age >= 13:

Timeline โ€“ Module One Learning Path

  +------------------------------------------------------------------+
  |  Lesson 1: What is Programming?                                  |
  |  Lesson 2: What is Python?                                      |
  |  Lesson 3: Setting Up Python                                    |
  |  Lesson 4: Your First Program โ€“ Hello, World!                   |
  |  Lesson 5: Variables โ€“ Storing Information                      |
  |  Lesson 6: Data Types โ€“ Numbers and Text                        |
  |  Lesson 7: User Input โ€“ Asking Questions                        |
  |  Lesson 8: Conditional Statements โ€“ Making Decisions (if, else) |
  |  Lesson 9: Loops โ€“ Repeating Code (while loop)                  |
  |  Lesson 10: Loops โ€“ Repeating Code (for loop)                   |
  |  Lesson 11: Lists โ€“ Storing Many Items                          |
  |  Lesson 12: Functions โ€“ Reusable Code Blocks                    |
  |  Lesson 13: Comments โ€“ Explaining Your Code                     |
  |  Lesson 14: Debugging โ€“ Fixing Errors                           |
  |  Lesson 15: Review                                              |
  +------------------------------------------------------------------+

23. End-of-Module Summary

In this first module, we have taken our first steps into the world of Python programming. We learned what programming is and why Python is a great language to start with. We set up Python on our computers and wrote our first "Hello, World!" program. We learned about variables and how they store data. We explored different data types โ€“ integers, floats, and strings. We discovered how to get user input with input() and how to make decisions with if/else statements. We learned about loops โ€“ while and for โ€“ to repeat code. We also learned about lists to store many items, functions to reuse code, comments to explain our code, and debugging to fix errors.

Remember, learning to code is like learning a new language โ€“ it takes practice. Every programmer started where you are now. Keep coding, keep exploring, and have fun! You are now ready to move on to Module Two, where we will learn even more exciting things about Python.


24. Frequently Asked Questions

  1. What is Python? A popular programming language that is easy to learn.
  2. Do I need to know math to learn Python? Basic math is helpful, but you don't need to be a math expert.
  3. What can I build with Python? Games, websites, data tools, and much more.
  4. Is Python free? Yes, Python is free and open source.
  5. What is a variable? A container for storing data.
  6. What is a string? A piece of text.
  7. What is a loop? Code that repeats.
  8. What is a function? A reusable block of code.
  9. What is debugging? Finding and fixing errors.
  10. Where can I learn more Python? Practice, online tutorials, and more courses!

25. Review Questions

  1. What is programming?
  2. What is Python?
  3. How do you set up Python?
  4. What is the "Hello, World!" program?
  5. What is a variable?
  6. What is an integer?
  7. What is a float?
  8. What is a string?
  9. How do you get user input?
  10. What does if/else do?
  11. What is a while loop?
  12. What is a for loop?
  13. What is a list?
  14. What is a function?
  15. What is debugging?

26. Fill-in-the-Blank

  1. _____ is writing instructions for computers. (Programming)
  2. _____ is a popular programming language. (Python)
  3. A _____ stores data. (variable)
  4. An _____ is a whole number. (integer)
  5. A _____ is a decimal number. (float)
  6. A _____ is a piece of text. (string)
  7. _____ gets user input. (input())
  8. _____ makes decisions. (if)
  9. A _____ loop repeats code. (while)
  10. A _____ is a collection of items. (list)

27. True or False

  1. Python is a programming language. (True)
  2. Variables store data. (True)
  3. An integer is text. (False โ€“ it's a number)
  4. A float is a whole number. (False โ€“ it's a decimal)
  5. A string is a number. (False โ€“ it's text)
  6. input() asks the user for information. (True)
  7. if makes decisions. (True)
  8. A while loop runs forever. (False โ€“ it runs while a condition is true)
  9. A for loop repeats code a specific number of times. (True)
  10. A list can store multiple items. (True)

28. Multiple Choice Questions

  1. What is Python?
    A) A game B) A programming language C) A food D) A car Answer: B
  2. What is a variable?
    A) A container for data B) A game C) A food D) A car Answer: A
  3. What is an integer?
    A) A whole number B) A piece of text C) A decimal number D) A list Answer: A
  4. What is a float?
    A) A whole number B) A piece of text C) A decimal number D) A list Answer: C
  5. What is a string?
    A) A piece of text B) A whole number C) A decimal number D) A list Answer: A
  6. What does input() do?
    A) Gets user input B) Prints output C) Makes a decision D) Repeats code Answer: A
  7. What does if do?
    A) Makes a decision B) Repeats code C) Stores data D) Gets user input Answer: A
  8. What is a while loop?
    A) Repeats code while a condition is true B) Repeats code a set number of times C) Stores data D) Makes a decision Answer: A
  9. What is a for loop?
    A) Repeats code a set number of times B) Repeats code while a condition is true C) Stores data D) Makes a decision Answer: A
  10. What is a list?
    A) A collection of items B) A piece of text C) A whole number D) A decimal number Answer: A
  11. What is a function?
    A) A reusable block of code B) A collection of items C) A piece of text D) A whole number Answer: A
  12. What is a comment?
    A) A note in the code B) A variable C) A loop D) A function Answer: A
  13. What is debugging?
    A) Fixing errors B) Writing code C) Storing data D) Making decisions Answer: A
  14. Which is a Nigerian example?
    A) A program converting Naira to Dollars B) A program in London C) A program in New York D) A program in Tokyo Answer: A
  15. Is Python free?
    A) Yes B) No Answer: A

29. Matching Exercises

TermDefinition
PythonA) Stores multiple items
VariableB) Reusable block of code
ListC) Programming language
FunctionD) Container for data
CommentE) Note in the code

Answers: Python-C, Variable-D, List-A, Function-B, Comment-E


30. Short Answer Questions

  1. What is Python?
  2. What is a variable?
  3. What is the difference between an integer and a string?
  4. What does if/else do?
  5. What is a loop?
  6. What is a list?
  7. What is a function?

31. Scenario-based Exercises

Scenario 1: You want to write a program that asks the user for their name and age, then prints a message saying "Hello, [name]! You are [age] years old."

Task: Write the code to do this.

Answer:

  name = input("What is your name? ")
  age = input("How old are you? ")
  print("Hello, " + name + "! You are " + age + " years old.")

Scenario 2: You want to write a program that checks if a number is even or odd.

Task: Write the code to do this.

Answer:

  number = int(input("Enter a number: "))
  if number % 2 == 0:
      print(number, "is even.")
  else:
      print(number, "is odd.")

32. Group Activity

In groups of three, write a program that asks each group member for their name and favourite food. Store the names and foods in lists. Then, print a message like "Ada likes Jollof Rice." Share your program with the class.


33. Individual Activity

Write a program that asks the user for a number and prints the multiplication table for that number (from 1 to 10).


34. Classroom Discussion Questions

  • What is the most interesting thing you learned about Python?
  • What program would you like to build with Python?
  • How can Python help Nigerian businesses?
  • What is one challenge you faced when learning Python?
  • How do you fix errors in your code?

35. Mini Project

Build a simple "Quiz Game" program. The program should:

  1. Ask the user 5 multiple-choice questions.
  2. Check if the answers are correct.
  3. Keep score and display the final score at the end.

36. Practical Assignment

Write a program that acts as a simple calculator. It should:

  1. Ask the user for two numbers.
  2. Ask the user for an operation (+, -, *, /).
  3. Perform the calculation and print the result.

37. Challenge Exercise

Write a program that stores the names and scores of 5 students. Then, calculate and print the average score, the highest score, and the lowest score. Also, print the name of the student with the highest score.


38. Quiz Answers

Fill-in-the-blank: 1. Programming, 2. Python, 3. variable, 4. integer, 5. float, 6. string, 7. input(), 8. if, 9. while, 10. list

True/False: 1T, 2T, 3F, 4F, 5F, 6T, 7T, 8F, 9T, 10T

Multiple Choice: 1B, 2A, 3A, 4C, 5A, 6A, 7A, 8A, 9A, 10A, 11A, 12A, 13A, 14A, 15A

Matching: Python-C, Variable-D, List-A, Function-B, Comment-E


39. Key Takeaways

  • ๐Ÿ”น Python is a beginner-friendly programming language.
  • ๐Ÿ”น Variables store data for later use.
  • ๐Ÿ”น Data types include integers (whole numbers), floats (decimals), and strings (text).
  • ๐Ÿ”น if/else statements make decisions.
  • ๐Ÿ”น Loops (while and for) repeat code.
  • ๐Ÿ”น Lists store collections of items.
  • ๐Ÿ”น Functions are reusable code blocks.
  • ๐Ÿ”น Comments explain your code.
  • ๐Ÿ”น Debugging is fixing errors.
  • ๐Ÿ”น Practice is the key to becoming a great programmer.

40. Preparation for the Next Module

In Module Two, we will build on what you have learned. You will explore more advanced topics like:

  • Working with dictionaries and sets.
  • File input and output (reading/writing files).
  • Error handling with try/except.
  • Writing more complex functions with parameters and return values.
  • Introduction to object-oriented programming.
  • Building larger projects.

Keep practicing and exploring. You are on your way to becoming a Python expert!


๐ŸŽ‰ Congratulations! You have completed Module One: Welcome to Python Programming ๐ŸŽ‰

You are now ready for Module Two โ€“ Advanced Python Concepts!

๐Ÿ† 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.
โ†’