Introduction

Python is a high-level, versatile programming language used for a wide range of applications such as web development, automation, data analysis, artificial intelligence, and scientific computing. It is open-source, platform-independent, and supported by a large global community, making it one of the most popular languages today.

Python is known for its simple, readable syntax that resembles the English language, allowing developers to write clean and efficient code with fewer lines. It supports multiple programming paradigms, including procedural, object-oriented, and functional programming, and runs on an interpreter, enabling quick testing and prototyping.

History of Python

  1. Created by Guido van Rossum in the late 1980s, with development starting in December 1989 at CWI (Centrum Wiskunde & Informatica) in the Netherlands.
  2. First released as Python 0.9.0 in February 1991, featuring functions, exception handling, and core data types.
  3. Python 2.0 was released in 2000, introducing list comprehensions and garbage collection.
  4. Python 3.0 came in 2008, designed to fix inconsistencies and improve the language, but not backward compatible with Python 2.
  5. Today, Python is maintained by the Python Software Foundation and widely used across industries.

Hello World

The “Hello World” program is the simplest way to begin learning Python. It displays a short message on the screen and helps beginners understand Python’s straightforward syntax. Since Python uses an interpreter, you can run the code instantly without compiling. To print a message, you use the built-in print() function.

Example:

print("Hello, World!")
print("Good Afternoon")

Variables

Variables in Python are used to store data values such as numbers, text, or other objects. Python uses dynamic typing, meaning you do not need to declare a variable’s type—it is automatically determined by the assigned value. A variable is created when a value is assigned using the = operator.

For example: x = 5 (integer) or name = "John" (string).

Variable names are case-sensitive, must begin with a letter or underscore, and cannot start with a number.

Data Types

Python provides several built-in data types to categorize values stored in variables. Some commonly used types are:

Example:

a = 5
print(type(a))

Strings

A string in Python is a sequence of characters enclosed within single quotes (' ') or double quotes (" "). Strings are used to store text and can include letters, numbers, symbols, and spaces. Python provides several operations and methods to work with strings, such as:

Conditional Statements

Example:

x = 10
if x > 0:
    print("Positive")
elif x == 0:
    print("Zero")
else:
    print("Negative")

Functions

A function in Python is a block of reusable code that performs a specific task. Functions help organize programs, reduce repetition, and make code easier to maintain. Python provides built-in functions like print() and len(), and also allows users to define custom functions using the def keyword. A function can accept input values called parameters and can return a value using the return statement.

Arrays and Its Types

An array in Python is a collection of elements stored in a single variable. Arrays can hold multiple values and allow operations like indexing, slicing, and iteration. Python provides arrays mainly in two forms: lists, which are dynamic and can hold elements of different types, and arrays from the array module, which store elements of a specific type for memory efficiency.

Modules

A module in Python is a file containing Python code—such as functions, classes, or variables—that can be reused in other programs. Modules help organize code, promote reusability, and make programs easier to maintain. Python includes a rich standard library of built-in modules like math, random, and os, and developers can also create custom modules. Modules are imported into a program using the import statement.

Reference

  1. Python 3 Documentation
  2. Python Tutorial
  3. Python Programming Language Tutorial
  4. Python Tutorials and Guides