Python Basics Notes
Python Basics Notes
1. Introduction to Python
• Python is a beginner-friendly, easy-to-read programming language.
• print() function is used to display output on the screen.
Example: print("Hello, World!")
2. Variables
• Variables are names used to store data values.
• Python automatically detects the data type.
Examples:
name = "Ali"
age = 18
is_student = True
3. Data Types
• int: Whole numbers → age = 20
• float: Decimal numbers → height = 5.9
• str: Text → name = "Sara"
• bool: True/False → is_active = False
• Other common types: list, dict
4. Operators
A. Arithmetic Operators
• + (Addition)
• - (Subtraction)
• * (Multiplication)
• / (Division)
• // (Floor Division)
• % (Modulus)
• ** (Exponentiation)
B. Comparison Operators
• == (Equal to)
• != (Not equal to)
• > (Greater than)
• < (Less than)
• >= (Greater than or equal to)
• <= (Less than or equal to)
C. Logical Operators