By the end of this lesson you can
- Name the four main parts of a computer (input, CPU, memory, output) and say what each one does when a program runs.
- Explain what a program and an algorithm are, and write the steps of an everyday task in the correct order.
- Explain why we write in a programming language instead of machine code, and run and change a one-line Python program.
01Notes
Why this lesson matters
You pay a friend Rs. 200 on UPI. In under two seconds, your phone reads the amount you typed, checks your PIN, talks to your bank, and shows a green tick.
No person did those steps. A program did. Someone wrote clear instructions, in the right order, and the computer followed them exactly.
In this lesson you will learn what a computer really does, what a program is, and why we need a language like Python to talk to a computer.
And you don't have to wait till the end to touch code. In the very next step, you will run your first Python program, without typing a single letter.
02Try it
Your first program: just press Run
Don't worry about understanding anything yet. Below is a complete Python program, already written for you. You don't have to type anything.
1. Press **Run**.
2. Look at the output panel on the right.
3. Press **Submit**.
That's it. You have just run your first Python program! Millions of programmers, including the ones at Google and Instagram, started with exactly this line. In the next video, I will tell you what actually happened.
print("Hello World!")In the lesson player this runs in the BashaByte compiler.
03Concept video
Concept video: What is programming?
Video coming soon. About 7:00 long. The notes below cover everything in it.
0:00You just ran your first program1:00What a computer does2:45What a program is4:15Why programming languages5:45How every lesson works6:30Recap
04Notes
Notes: computers, programs and languages
1. What a computer doesLink to this section
Every computer, from your phone to a bank server, works in three stages:
Input -> Process -> Output
| Part | What it does | Examples |
|---|---|---|
| Input | Takes data in | Keyboard, mouse, touch screen, camera, microphone |
| CPU (processor) | Runs instructions: calculates and decides | Intel Core, AMD Ryzen, Apple M-series, Snapdragon |
| Memory (RAM) | Holds the program and data being used right now; cleared when power goes off | 8 GB RAM |
| Storage | Keeps files and apps permanently | SSD, hard disk, pen drive |
| Output | Shows or sends the result | Screen, speaker, printer |
Kitchen example
the recipe book is storage, the kitchen counter is RAM, the cook is the CPU, and the plate served is the output. The cook can only work with what is on the counter, so data is brought from storage into RAM before the CPU uses it.
2. What is a program?Link to this section
A program is a set of instructions, written in order, that a computer follows exactly.
An algorithm is the plan behind it: the step-by-step method to solve a problem. First we think of the algorithm, then we write it as a program.
Example algorithm: making tea 1. Boil water. 2. Add tea powder. 3. Add milk and sugar. 4. Boil for 2 minutes. 5. Filter into a cup.
If you filter before boiling, you get no tea. Computers are the same: they do exactly what you write, in the order you write it. They do not guess what you meant.
3. Why do we need programming languages?Link to this section
The CPU understands only machine code: long patterns of 0s and 1s, like 10110000 01100001. Humans cannot write big programs this way quickly or without mistakes.
A programming language lets us write instructions in a form close to English. A translator program then turns them into machine code. Python's translator is called the interpreter. You will learn more about it in Lesson 1.5.
Your first Python instruction:
print("Hello, BashaByte!")
Output
Hello, BashaByte!
print() shows on the screen whatever you put inside the brackets. Text must be inside quotes.
4. How this course worksLink to this section
Every lesson has the same 8 steps: video, notes, predict the output, try it in the compiler, arrange the code, quick check with fix-the-bug, and coding tasks. Each module ends with a mini-project and an exam. Use hints only after you have tried.
Common mistakes
- Thinking RAM and storage are the same. RAM is temporary working space; storage is permanent.
- Forgetting the quotes:
print(Hello)is an error,print("Hello")is correct. - Writing
Printwith a capital P. Python is case-sensitive, so it must beprint.
Key words
Input, output, CPU, RAM, storage, program, algorithm, machine code, programming language, interpreter.
05Predict the output
Predict the output
Read each program. Decide what it will print before you look at the options. Then check your answer.
What is the output of this program?
print("Hi")
print("Python")
What is the output of this program?
print("5 + 3")
You'll answer these in the lesson player, with an explanation after every choice.
06Fix the bug
Spot the difference
This program should print exactly: Hello World! Run it. The output looks almost the same, but not exactly. Put your output and the expected line one below the other and compare them letter by letter. Find the tiny difference and fix it. This is the most important habit in programming: the computer prints exactly what you tell it, not what you meant.
The program should print exactly:
Hello World!
Run it, compare the output with the expected line letter by letter, and fix the difference.
print("Hello world!")In the lesson player your code is checked against hidden tests, with hints if you get stuck.
07Try it
Try it: run and change
1. Press Run and look at the output.
2. Change the text inside the quotes to your own name and run again.
3. Add one more print line that shows your city.
4. Remove one quote mark and run. Read the error message, then fix it.
print("Hello, BashaByte!")
print("I am learning Python.")In the lesson player this runs in the BashaByte compiler.
08Arrange the code
Arrange the code: ATM withdrawal
These print lines describe how an ATM gives you cash, but they are mixed up. Drag them into the correct order. One line does not belong anywhere; leave it out.
print("Enter your PIN")print("Print the passbook")print("Take your card")print("Insert your card")print("Take your cash")print("Enter the amount")
In the lesson player you drag these into order.
09Quick check
Quick check
Five questions on this lesson. You need 60% to complete the lesson. Read the explanation after each answer.
Which part of the computer runs the instructions of a program?
You are typing a document and the power goes off before you save it. What is lost?
Which statement best describes a program?
Why do programmers write in Python instead of machine code?
In a UPI payment app, typing the amount you want to send is an example of which stage?
You'll answer these in the lesson player, with an explanation after every choice.
10Fix the bug
Fix the bug
This program should print a welcome message, but it does not run. Find the mistake and fix it.
This program should print exactly:
Welcome to BashaByte
It shows an error instead. Find the mistake and fix it.
print("Welcome to BashaByte)In the lesson player your code is checked against hidden tests, with hints if you get stuck.
11Coding task
Hello, World!
Solve the three tasks. Your output must match exactly, including spaces and capital letters. Pass at least 2 to complete the lesson.
Write a program that prints exactly:
Hello, World!
Check the comma, the space and the exclamation mark.
# Write your code belowIn the lesson player your code is checked against hidden tests, with hints if you get stuck.
12Coding task
Welcome banner
Solve the three tasks. Your output must match exactly, including spaces and capital letters. Pass at least 2 to complete the lesson.
Print this banner exactly, in three lines:
Welcome to Python
The star lines have exactly 10 stars each.
# Write your code belowIn the lesson player your code is checked against hidden tests, with hints if you get stuck.
13Coding task
Input, process, output of a calculator
Solve the three tasks. Your output must match exactly, including spaces and capital letters. Pass at least 2 to complete the lesson.
A calculator app adds two numbers. Print its three stages, in the correct order, exactly like this:
Input: two numbers Process: add them Output: their sum
# Write your code belowIn the lesson player your code is checked against hidden tests, with hints if you get stuck.
Like the way this lesson works?
Enroll in Core Python to take every lesson with live practice and progress tracking.
See the full course