Unit 1:
Introduction
to Python
AKTU SYLLABUS - PYTHON PROGRAMMING
TOPICS: VARIABLES, OPERATORS, BLOCKS, AND DATA TYPES
Introduction to Python
• Python is a high-level, interpreted, and general-
purpose programming language.
• Created by Guido van Rossum and released in
1991.
• Emphasizes code readability with simple syntax.
• Applications: Web development, Data Science,
AI, Automation, etc.
• Python uses indentation to define code blocks.
Python Variables
• Variables are containers for storing data values.
• No need to declare type explicitly; Python infers
it.
• Example:
x = 10
name = 'Alice'
pi = 3.14
• Variable names are case-sensitive and must
start with a letter or underscore.
Python Basic Operators
• Arithmetic Operators: +, -, *, /, %, **, //
• Comparison Operators: ==, !=, >, <, >=, <=
• Logical Operators: and, or, not
• Assignment Operators: =, +=, -=, *=, /=
• Example:
a, b = 5, 3
print(a + b) # 8
Understanding Python
Blocks
• Python uses indentation instead of braces ({ })
to define blocks.
• Typically uses 4 spaces per indentation level.
• Example:
if True:
print('Inside block')
x=5
• Improper indentation causes errors.
Python Data Types and
Numeric Types
• Python has various built-in data types:
- int: Integer numbers (e.g., 5, -10)
- float: Decimal numbers (e.g., 3.14, -2.5)
- str: Strings (e.g., 'Hello')
- bool: True or False
• Type conversion:
int(3.9) → 3
float(5) → 5.0