Computer Programming II: Introduction to Python and JavaScript with Real Code Examples (NERDC Aligned)
INTRODUCTION
Think about the apps on your phone right now. Your music app, your mobile banking app, the website where you read football news — every single one was built by someone who knew how to write code. That someone could be you.
Nigeria is changing fast. From Flutterwave processing millions of payments to Andela connecting African developers with global companies, software is at the centre of it all. Learning to write code as an SSS 2 student puts you in a powerful position. You are not just a user of technology — you are on your way to becoming a creator.
In this lesson, we will look at two of the most popular and beginner-friendly programming languages in the world today: Python and JavaScript. By the end, you will understand what they are, how they work, and you will be able to write simple but real programs using both.
LEARNING OBJECTIVES (NERDC STYLE)
By the end of this lesson, students should be able to:
- Define programming languages and explain the role they play in software development.
- Identify the key features and differences between Python and JavaScript.
- Write basic programs using Python and JavaScript syntax.
- Explain core programming concepts such as variables, data types, conditions, and loops.
- Demonstrate the use of functions in both Python and JavaScript.
- Relate programming skills to real-life applications in the Nigerian context.
What Is Computer Programming?
Computer programming is the process of writing a set of instructions that a computer can understand and execute. These instructions are written in a special language called a programming language. Just like we use English or Yoruba to communicate with people, we use programming languages to communicate with computers.
A program is simply a collection of these instructions put together to perform a specific task. When you open a banking app and check your account balance, a program is running behind the scenes to fetch and display that information.
Why Python and JavaScript?
There are hundreds of programming languages in existence, but Python and JavaScript stand out for beginners and professionals alike.
Python was created by Guido van Rossum and first released in 1991. It is known for being clean, simple, and easy to read. Many data scientists, artificial intelligence engineers, and automation specialists use Python daily. In Nigerian universities, Python is increasingly taught as the first programming language.
JavaScript was created by Brendan Eich in 1995 and is the language of the web. Every interactive website you have ever visited — buttons that respond to clicks, forms that validate your input, pop-up messages — was most likely powered by JavaScript. It runs directly in your web browser without needing to install anything extra.
Introduction to Python
Key Features of Python
- Python code reads almost like English, which makes it easier to learn.
- It uses indentation (spacing) to organise code instead of curly braces.
- Python is free and runs on Windows, Mac, and Linux.
- It has a large community and thousands of free resources online.
- Python is used in web development (Django, Flask), data science, artificial intelligence, and automation.
Python Syntax Basics
Syntax is simply the set of rules that defines how code must be written in a language. Let us look at the building blocks.
VARIABLES AND DATA TYPES
A variable is like a container that holds a value. In Python, you do not need to declare the type of a variable before using it.
Example:
student_name = "Amaka" age = 17 gpa = 3.8 is_registered = True
print(student_name) print(age)
Output: Amaka 17
In this example, student_name holds a text value (called a string), age holds a whole number (integer), gpa holds a decimal number (float), and is_registered holds a True or False value (boolean).
TAKING INPUT FROM THE USER
name = input("Enter your name: ") print("Welcome to our school portal, " + name)
Output (if the user types Chidi): Welcome to our school portal, Chidi
This is similar to how many Nigerian school portals ask you to enter your name or student ID before granting access.
IF STATEMENTS (CONDITIONS)
score = 65
if score >= 50: print("You passed!") else: print("You need to study harder.")
Output: You passed!
Conditions allow our program to make decisions — just like a human would. If the score is 50 or above, print one thing. Otherwise, print something else.
FOR LOOPS
A loop allows us to repeat an action multiple times without writing the same code over and over again.
for i in range(1, 6): print("Day", i)
Output: Day 1 Day 2 Day 3 Day 4 Day 5
FUNCTIONS
A function is a block of reusable code that performs a specific task. Instead of writing the same code in different places, you write it once as a function and call it whenever you need it.
def greet_student(name): print("Hello, " + name + "! Welcome to Computer Studies.")
greet_student("Tunde") greet_student("Ngozi")
Output: Hello, Tunde! Welcome to Computer Studies. Hello, Ngozi! Welcome to Computer Studies.
H2: Section 2 — Introduction to JavaScript
H3: Key Features of JavaScript
- JavaScript runs directly in web browsers — no installation needed.
- It makes web pages interactive and dynamic.
- JavaScript can also run on servers using a tool called Node.js.
- It is the most widely used programming language on the internet today.
- Major Nigerian tech companies like Paystack and Konga use JavaScript extensively in their platforms.
JavaScript Syntax Basics
VARIABLES AND DATA TYPES
In JavaScript, we use let or const to declare variables.
let studentName = "Amaka"; let age = 17; let gpa = 3.8; const schoolName = "Government Secondary School, Abuja";
console.log(studentName); console.log(age);
Output: Amaka 17
Note: const is used for values that will not change (like a school name), while let is used for values that can change (like a score or age).
IF STATEMENTS (CONDITIONS)
let score = 65;
if (score >= 50) { console.log("You passed!"); } else { console.log("You need to study harder."); }
Output: You passed!
Notice that JavaScript uses curly braces to group blocks of code, while Python uses indentation. Both achieve the same result — they are just different styles.
FOR LOOPS
for (let i = 1; i <= 5; i++) { console.log("Day " + i); }
Output: Day 1 Day 2 Day 3 Day 4 Day 5
FUNCTIONS
function greetStudent(name) { console.log("Hello, " + name + "! Welcome to Computer Studies."); }
greetStudent("Tunde"); greetStudent("Ngozi");
Output: Hello, Tunde! Welcome to Computer Studies. Hello, Ngozi! Welcome to Computer Studies.
Python vs JavaScript — A Simple Comparison
Feature | Python | JavaScript Purpose | Data science, AI, automation, web backend | Web interactivity, web backend (Node.js) Syntax style | Uses indentation | Uses curly braces {} Where it runs | Computer terminal or server | Web browser or server (Node.js) Ease of learning | Very beginner-friendly | Beginner-friendly but slightly more syntax Popular use in Nigeria | Data analysis, school systems, scripts | Banking apps, e-commerce websites, fintech
Practical Applications in Real Life (Nigerian Context)
Programming is not just a school subject — it is used every day around us. Here are some ways Python and JavaScript are applied in Nigeria:
-
School Management Systems — Python is used to build portals that store student records, generate results, and send notifications to parents. Many state governments are now adopting such systems.
-
Mobile Money and Fintech — Apps like Opay, Palmpay, and Kuda use JavaScript (among other technologies) to create smooth and secure payment experiences.
-
E-commerce Platforms — Jumia and other online stores use JavaScript to make their product pages interactive — allowing you to add items to a cart, filter products, and complete purchases without reloading the page.
-
Agriculture and Farming Technology — Python is increasingly used in agri-tech startups in Nigeria to analyse soil data, predict crop yields, and improve farming decisions.
-
Chatbots and Customer Service — Many Nigerian businesses now use Python-powered bots to respond to customer queries automatically on WhatsApp and websites.
Advantages and Disadvantages
ADVANTAGES OF PYTHON:
- Very easy to read and write, even for beginners
- Huge library of tools and resources (called packages) that save time
- Widely used in high-paying careers like data science and machine learning
- Great for automating repetitive tasks
DISADVANTAGES OF PYTHON:
- Slower than some other languages like C++ for certain tasks
- Not naturally suited for mobile app development
- Less commonly used on the front-end (visible part) of websites
ADVANTAGES OF JAVASCRIPT:
- Works directly in all web browsers — no setup required
- Can be used for both the visible part (frontend) and behind-the-scenes part (backend) of a website
- Enormous community and job market
- Ideal for building interactive websites and apps
DISADVANTAGES OF JAVASCRIPT:
- Can behave unexpectedly in some browsers if not written carefully
- More complex syntax compared to Python for complete beginners
- Security vulnerabilities if code is not written carefully
Safety and Ethical Considerations in Programming
As a young programmer, it is important to know that the skills you are learning come with responsibilities. Here are some things to keep in mind:
-
Do not write programs to harm others. Using code to access someone else's data without permission is illegal and unethical. This is called hacking, and it is a criminal offence in Nigeria under the Cybercrimes Act 2015.
-
Protect user privacy. If you ever build an app that collects people's names, phone numbers, or other personal data, you have a duty to keep that data safe and use it only for the purpose the person agreed to.
-
Give credit where it is due. If you use code written by someone else, acknowledge it. Copying someone else's code and claiming it as your own is plagiarism — just as it is in writing.
-
Use your skills to solve real problems. Nigeria faces many challenges — in health, education, agriculture, and infrastructure. The best programmers are those who use their knowledge to make life better for their communities.
Classroom and Home Activities
ACTIVITY 1 — Hello, Nigeria! Write a Python program that asks the user to enter the name of their state in Nigeria and then prints a welcome message. For example, if the user types "Lagos", the program should print: "Welcome from Lagos! Nigeria is great."
ACTIVITY 2 — Grade Calculator Write a program in either Python or JavaScript that accepts a student's score as input and displays the corresponding grade: A (70-100), B (60-69), C (50-59), D (45-49), F (below 45).
ACTIVITY 3 — Times Table Generator Using a for loop in Python, write a program that prints the multiplication table of any number entered by the user. For example, if the user enters 5, the program should print: 5 x 1 = 5, 5 x 2 = 10 ... up to 5 x 10 = 50.
ACTIVITY 4 — JavaScript Alert Open your web browser, press F12 to open Developer Tools, click on the Console tab, and type the following:
let name = prompt("What is your name?"); alert("Hello, " + name + "! You just ran your first JavaScript program.");
Observe what happens and write down what you notice in your exercise book.
H2: Assessment Questions
SECTION A — OBJECTIVE QUESTIONS (5 Questions)
- Which of the following is the correct way to display output in Python? (a) echo("Hello") (b) printf("Hello") (c) print("Hello") (d) console.log("Hello")
Answer: (c)
- What keyword is used in JavaScript to declare a variable that can change its value later? (a) var (b) const (c) def (d) let
Answer: (d)
- Which programming language uses indentation to define blocks of code? (a) JavaScript (b) Java (c) Python (d) C++
Answer: (c)
- The following Python code: for i in range(1, 4): print(i) What will be the output? (a) 1 2 3 4 (b) 0 1 2 3 (c) 1 2 3 (d) 1 2 3 4 5
Answer: (c)
- In JavaScript, which method is used to display output in the browser console? (a) print() (b) display() (c) console.log() (d) output()
Answer: (c)
SECTION B — THEORY QUESTIONS (3 Questions)
-
Define a programming language and explain why Python and JavaScript are considered good choices for beginners. Give one real-life example of how each language is used in Nigeria.
-
Explain the difference between a variable and a function in programming. Write one example each in Python to support your answer.
-
Write a Python program that accepts a student's name and score from the user. The program should print the student's name and whether they passed or failed (pass mark is 50). Show your code and explain what each line does.
H2: Summary
Here is a quick recap of what we covered in this lesson:
- Computer programming is the process of writing instructions for a computer to follow.
- Python is a clean, readable language widely used in data science, artificial intelligence, and automation. It uses indentation to structure code.
- JavaScript is the language of the web. It makes websites interactive and runs in every browser without installation. It uses curly braces to structure code.
- Both languages share common programming concepts: variables, data types, conditions (if statements), loops (for), and functions.
- Programming has direct, practical applications in Nigeria — in fintech, e-commerce, education, and agriculture.
- As a programmer, you have an ethical responsibility to use your skills honestly and for the benefit of others.
H2: Conclusion
The journey into programming can feel like learning a new language, and in many ways it truly is. But unlike most languages, programming opens doors across every field imaginable — from medicine to music, from farming to finance. Nigeria needs more builders, and every time you write a line of code, you are becoming one of them.
Start small. Practice the examples in this lesson. Try the activities. Make mistakes and correct them — that is how every great programmer learned. Python and JavaScript are two of the most in-demand skills in the global job market today, and you now have your first real introduction to both.
The world is built by people who write code. Start building yours.
H2: Frequently Asked Questions (FAQ)
Q1: Do I need a computer to learn Python or JavaScript as an SSS 2 student in Nigeria? A: You do not necessarily need a personal computer. You can practice Python on your Android phone using free apps like Pydroid 3 or QPython. For JavaScript, you can use the browser console on any phone or computer by pressing F12. There are also free online coding platforms like Replit and Programiz that work on mobile browsers.
Q2: Which is better to learn first — Python or JavaScript? A: Both are excellent starting points. Python is generally considered easier because its syntax is closer to everyday English and it has fewer rules to worry about. However, if you are more interested in building websites and seeing your results in a browser, JavaScript gives you more immediate visual feedback. Many Nigerian developers recommend Python first, then JavaScript.
Q3: Is computer programming part of the official NERDC curriculum for SSS 2? A: Yes. The NERDC curriculum for Computer Studies at the Senior Secondary level includes introductory programming concepts. Students are expected to understand programming logic, write basic programs, and understand how software is developed. Python and JavaScript are widely accepted as appropriate languages for this level.
Q4: Can learning Python or JavaScript help me get a job in Nigeria? A: Absolutely. Nigerian tech companies like Flutterwave, Paystack, Kuda, Andela, and many others hire developers who know Python and JavaScript. Freelancing platforms like Upwork and Fiverr also allow Nigerian developers to work for international clients and earn in dollars. Learning these languages is a genuinely marketable skill.
Q5: How long does it take to learn Python or JavaScript? A: With consistent daily practice, most students can understand the basics within four to eight weeks. The key is not how fast you learn, but how consistently you practice. Spending even 30 minutes a day writing code will produce noticeable results.
Q6: Are there free resources where I can learn more about Python and JavaScript? A: Yes. Some of the best free resources include Python.org (the official Python website), freeCodeCamp.org, W3Schools.com, Khan Academy, and YouTube channels like Corey Schafer (for Python) and Traversy Media (for JavaScript). All of these are accessible in Nigeria with a basic internet connection.
Subject: Computer Studies Class: Senior Secondary School 2 (SSS 2) Topic: Computer Programming II — Introduction to Python and JavaScript Curriculum: NERDC Word Count: Approximately 2,100 words

0 Comments