Python Language Notes
1. Definition
Python is a general-purpose, high-level, interpreted programming language used for
developing applications in various domains such as data analysis, web development,
automation, and artificial intelligence.
2. Features of Python
● Simple and readable syntax
● Interpreted (no need for compilation)
● Portable (runs on different operating systems)
● Extensive libraries for data, web, and AI tasks
● Object-oriented and functional
● Dynamic typing (no need to declare variable type)
3. Applications of Python
● Data Analytics and Visualization – Pandas, Matplotlib, Seaborn
● Web Development – Django, Flask
● Machine Learning and AI – Scikit-learn, TensorFlow, PyTorch
● Automation and Scripting – File handling, task automation
● Game Development – Pygame
● Desktop Applications – Tkinter, PyQt
4. Keywords
● Reserved words with special meanings.
● Cannot be used as variable names.
● Examples:
if, else, for, while, def, class, import, return, break, continue, True,
False, None
You can check all keywords using:
import keyword
print([Link])
5. Variables
● Used to store data values.
● Created automatically when you assign a value.
Example:
name = "Adeeba"
age = 25
●
● No need to declare type explicitly.
6. Data Types
Type Example Description
int 10 Integer number
float 10.5 Decimal number
str "Python" String of text
bool True/False Boolean value
list [1, 2, 3] Ordered, mutable collection
tuple (1, 2, 3) Ordered, immutable collection
dict {"name": "Adeeba", "age": 25} Key-value pairs
set {1, 2, 3} Unordered, unique values
7. Decision Making (Conditional Statements)
Used to execute code based on conditions.
Syntax:
if condition:
statement1
elif condition2:
statement2
else:
statement3
Example:
age = 18
if age >= 18:
print("Eligible to vote")
else:
print("Not eligible")
8. Looping
Used to repeat a block of code multiple times.
For Loop:
for i in range(5):
print(i)
While Loop:
count = 1
while count <= 5:
print(count)
count += 1
Control Statements:
break, continue, pass
9. Functions
Used to group reusable code blocks.
Syntax:
def function_name(parameters):
# code
return value
Example:
def greet(name):
return "Hello, " + name
print(greet("Adeeba"))