**Class Notes on Python Programming**
Title: Introduction to Python Programming
Introduction:
Python is a high-level, interpreted programming language known for its
simplicity and readability.
It is widely used in various fields, such as web development, data analysis,
artificial intelligence, and scientific computing.
1. Syntax and Data Types
1.1 Variables and Data Types:
Variables: Used to store data that can be used and manipulated later.
Example: name = "John Doe", age = 25
Common Data Types:
String: A sequence of characters enclosed in quotes.
Example: name = "Alice"
Integer: Whole numbers.
Example: age = 30
List: A collection of items.
Example: fruits = ["apple", "banana", "cherry"]
2. Control Flow
2.1 Conditional Statements (if, elif, else):
Example:
if age >= 18:
print("You are an adult.")
else:
print("You are a minor.")
2.2 Loops:
For Loop:
for i in range(5):
print(i)
While Loop:
count = 0
while count < 5:
print(count)
count += 1
3. Functions and Modules
3.1 Functions:
def greet(name):
return f"Hello, {name}!"
print(greet("Alice"))
3.2 Modules:
import math
print(math.sqrt(16))
4. Summary:
Python is a versatile and beginner-friendly language, ideal for a wide range of
programming tasks.