A programming language is a set of rules used to write instructions a computer can follow. High-level languages (like Python) are close to human language and easy to read. Low-level languages (like Assembly and Machine Code) are close to the hardware, faster, and use fewer resources.
Program — A set of instructions that tells the computer what to do.
High-level language — Easy for humans to read, e.g. Python.
Low-level language — Close to machine code; fast and precise.
Interpreter — Executes code line by line.
Try it — edit the code and press Run:
Item 2
Algorithms and Flowchart
An algorithm is a step-by-step procedure for solving a problem. A flowchart draws the algorithm using shapes: oval for Start/End, parallelogram for Input/Output, rectangle for Process and diamond for Decision.
Algorithm — A step-by-step procedure for solving a problem.
Flowchart — A diagram that represents an algorithm.
Pseudocode — Writing the steps in simple English before coding.
Try it — edit the code and press Run:
Item 3
Python Programming Structure
A Python program is made of statements, variables and comments. A variable stores a value. Variable names cannot start with a number, cannot contain spaces and are case-sensitive. Comments start with # and are ignored by Python.
Variable — A named place in memory that stores a value.
Comment — A note in code that Python ignores (#).
Indentation — Spaces at the start of a line that define code blocks.
Syntax — The grammar rules of the language.
Try it — edit the code and press Run:
Item 4
Output and User Input
print() displays output on the screen. Escape sequences like \n (new line) and \t (tab) format text. input() reads text from the user and always returns a string.
print() — Displays output.
input() — Accepts user input as a string.
Escape sequence — Special character starting with \ like \n or \t.
f-string — Formatted string: f"Hello {name}".
Try it — edit the code and press Run:
Quick Quiz
1. Which is the correct stage to convert an algorithm into code?
2. What is the role of the Python Interpreter?
3. Which of the following is an invalid variable name?
4. What is the correct way to output "Hello" in Python?
5. Which function is used to accept user input?
6. What is an algorithm?
Score: 0 / 6(Sign in to save your score)
Practice
Auto-checked exercises at three levels. Open hints one by one before the solution.
⭐Basic
Say hello
Print exactly: Hello, Python!
⭐⭐Intermediate
Print your name 5 times
Store the name Sara in a variable called name, then print it 5 times (each on a new line).
⭐⭐⭐Challenge
Profile card
Create name = "Ali", age = 16 and print using an f-string exactly:
Name: Ali | Age: 16
Smart Assistant Project
Task 1: Student Profiles
Goal: Initialize the project and store student profiles.
Requirement: Ask for a student's Name, Age and Grade_Level. Store them as variables and print a "Student Profile Card" using f-strings.