BASICS OF PYTHON PROGRAMMING
Source Notes
This document provides structured notes on the basics of Python programming language. It
includes definitions, examples, tables, charts, and illustrations for easy understanding.
1. Introduction to Python
Python is a high-level, interpreted programming language created by Guido van Rossum in 1991. It
is widely used for web development, data science, artificial intelligence, automation, and more.
Python emphasizes code readability and has a simple syntax similar to the English language.
Key Features of Python
Feature Description
Interpreted Executes line by line without compilation.
Dynamic Typing No need to declare variable types.
Cross-Platform Runs on Windows, macOS, and Linux.
Extensive Libraries Includes libraries for various domains.
Object-Oriented Supports OOP concepts like classes and inheritance.
2. Basic Syntax
Python uses indentation instead of braces or keywords to define code blocks. This makes the code
visually clean and highly readable.
Example:
# Hello World Program
print("Hello, World!")
# Simple Function
def greet(name):
print("Hello,", name)
greet("Python")
3. Data Types in Python
Python provides several built-in data types.
Type Example Description
int 10 Integer numbers
float 3.14 Decimal numbers
str 'Hello' Textual data
list [1, 2, 3] Ordered collection of items
tuple (1, 2, 3) Immutable ordered collection
dict {'a': 1, 'b': 2} Key-value pairs
set {1, 2, 3} Unordered unique items
4. Control Flow Statements
Python supports conditional statements and loops for controlling the flow of execution.
Example:
# If-Else Example
x = 10
if x > 5:
print("x is greater than 5")
else:
print("x is less than or equal to 5")
# For Loop Example
for i in range(3):
print("Iteration", i)
5. Popularity of Python
Python is one of the most popular programming languages in the world.
100
80
60
40
20
0
Python Java C++ JavaScript
6. Advantages of Python
Simple and easy to learn. Large standard library and community support. Cross-platform
compatibility. Supports multiple programming paradigms. Widely used in AI, ML, Data Science, and
Web Development.