TOPIC 1: Introduction to Python & Basic Operations

Site: Learning Management System
Course: Edo College ICT Club Programme
Book: TOPIC 1: Introduction to Python & Basic Operations
Printed by: Guest user
Date: Saturday, 3 January 2026, 7:46 AM

1. What is Python?

Python is a high-level, interpreted, and general-purpose programming language. It is designed to emphasize simplicity, readability, and ease of use, making it accessible to both beginners and experienced programmers. Python is highly popular due to its vast ecosystem of libraries that support applications in fields such as data science, machine learning, web development, and automation.

Key Features of Python:

  • Easy to Learn and Use: Python’s syntax is clean, straightforward, and user-friendly.
  • Interpreted Language: Python code is executed line by line, which simplifies debugging and testing.
  • Versatile: Python is used in various fields such as web development (Flask, Django), data science (Pandas, Matplotlib), machine learning (TensorFlow, scikit-learn), and automation (Selenium, web scraping).

2. Why Learn Python?

  •  Beginner-Friendly: Python has a clean and simple syntax that is easy to read and understand, making it ideal for beginners.
  • Versatile and Powerful: You can use Python for nearly any application, such as building websites, data analysis, automation, game development, and artificial intelligence.
  • Large Community & Libraries: Python has a vast ecosystem of libraries and frameworks, which makes it an excellent choice for rapid development.
  • Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).
  • Python has a simple syntax similar to the English language.
  • Python has syntax that allows developers to write programs with fewer lines than some other programming languages.
  • Python runs on an interpreter system, meaning that code can be executed as soon as it is written. This means that prototyping can be very quick.
  • Python can be treated in a procedural way, an object-oriented way or a functional way.

3. Python Syntax compared to other programming languages

  • Python was designed for readability, and has some similarities to the English language with influence from mathematics.
  • Python uses new lines to complete a command, as opposed to other programming languages which often use semicolons or parentheses.
  • Python relies on indentation, using whitespace, to define scope; such as the scope of loops, functions and classes. Other programming languages often use curly-brackets for this purpose.

4. What can Python do?

  • Python can be used on a server to create web applications.
  • Python can be used alongside software to create workflows.
  • Python can connect to database systems. It can also read and modify files.
  • Python can be used to handle big data and perform complex mathematics.
  • Python can be used for rapid prototyping, or for production-ready software development.

5. Installing Python

1.    Download Python:

  • Visit the official Python website and download the latest version of Python (Python 3.x).

2.    Install Python:

  • Run the installer and ensure to check the box that says "Add Python to PATH" during installation.

3.    Verify Installation:

  • After installation, open Command Prompt (Windows) or Terminal (macOS/Linux) and check the Python version by typing:

 python --version

  • This should display the installed Python version, e.g., Python 3.x.x.

6. Setting Up Your Development Environment

You'll need a code editor or IDE to write Python code. Below are the most popular ones for Python development:

- VS Code (Visual Studio Code): A lightweight, free code editor with Python support.

- Cursor: A modern IDE supporting Python development.
  •  Download it from Cursor.so and install the Python extension.

Once you have your IDE set up, you can start writing Python code directly within it.


7. Execute Python Syntax

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


Or by creating a python file on the server, using the .py file extension, and running it in the Command Line:

C:\Users\Your Name>python myfile.py


8. Python Indentation

Indentation refers to the spaces at the beginning of a code line.

Where in other programming languages the indentation in code is for readability only, the indentation in Python is very important.

Python uses indentation to indicate a block of code.

EXAMPLE:

if 5 > 2:
  print("Five is greater than two!")

Python will give you an error if you skip the indentation:

*Syntax Error*:
if 5 > 2:
print("Five is greater than two!")

The number of spaces is up to you as a programmer, the most common use is four, but it has to be at least one.

EXAMPLE:

if 5 > 2:
 print("Five is greater than two!") 
if 5 > 2:
        print("Five is greater than two!") 

You have to use the same number of spaces in the same block of code, otherwise Python will give you an error:

*Syntax Error*:
if 5 > 2:
 print("Five is greater than two!")
        print("Five is greater than two!")

9. Python Variables

In Python, variables are created when you assign a value to it:

Example

Variables in Python:

x = 5
y = "Hello, World!"

Python has no command for declaring a variable.

You will learn more about variables in the Python Variables chapter.



10. Comments

Python has commenting capability for the purpose of in-code documentation.

Comments start with a #, and Python will render the rest of the line as a comment:

Example

Comments in Python:

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