Unit 1 - Python Programming
Unit 1 - Python Programming
Why Python?
● High-level, interpreted, easy to learn.
● Dynamic typing & memory management.
● Widely used in data science, AI, web, and automation.
re Regular expressions
Data Types:
Type Example
Integer a = 10
Float pi = 3.14
String s = "hello"
Relational == != > < >= <= x > y, x == y Check values and relationships
● Bitwise Example
Identifiers:
● Variable/function names
● Must begin with a letter or _
● Cannot be Python keywords
➔ Identifiers are names used for variables or functions. They must start with a letter or
✅ ❌
underscore and cannot be Python keywords.
➔ Examples: name, _total Invalid: 2days, class, int, float
Indentation:
● Indentation in Python is used to define code blocks (like inside if, for, def, etc.) and is
mandatory.
Comments:
● Comments in Python are used to explain code and are ignored during execution.
● Single-line:
○ # This is a comment
● Multi-line:
○ Use triple quotes ''' or """