Wednesday, May 13, 2026
Cohort 3 | Project CloudIgnite Topics: Python Introduction, Data Types, Operators, Lists, Tuples, Dictionaries Duration: ~3 hours
🟡 AWS CLF-C02 Relevance sections are marked throughout this document.
Key Takeaways
- Mutable vs Immutable: list/dict/set = mutable; int/float/str/tuple = immutable
- Type conversion:
int(),float(),str();input()always returns a string - Operators:
//(floor division),%(modulo),**(power);and/or/not(not &&/||/!) - Lists: zero-indexed, negative indexing (-1 = last item), append/insert/pop/remove
- Tuples: immutable lists created with
(); Dicts: key-value pairs created with{} - For loops:
range(start, stop, step)— upper bound always exclusive - AWS Lambda: serverless, event-driven compute; pay per execution only; S3 upload → Lambda trigger
Table of Contents
- Python Introduction
- IDEs & Development Environment
- Running Python Code
- AWS Lambda & Python
- Python Basics — Identifiers & Variables
- Data Types
- Type Conversion
- Operators
- User Input & String Formatting
- Composite Data Types
- For Loops & Range
- Labs Covered
- AWS CLF-C02 Exam Relevance Summary
1. Python Introduction
- Python is a high-level, general-purpose programming language.
- Uses an interpreter (not a compiler): executes code line by line, unlike compiled languages that translate the whole program first.
- Dynamically typed: no need to declare variable types explicitly.
- Syntax resembles natural English — easier to learn than C, C++, or Java.
- Supports three programming paradigms:
- Structural (procedural)
- Functional
- Object-Oriented Programming (OOP)
- Cross-platform: code written on macOS works on Windows and Linux without modification.
- Python 2 vs Python 3: always use Python 3 (3.7, 3.8, 3.11, 3.12, etc. are all Python 3 — same syntax, more features).
- Files use the
.pyextension.
2. IDEs & Development Environment
An IDE (Integrated Development Environment) offers more than a plain text editor:
| Feature | Description |
|---|---|
| Syntax Highlighting | Colors for keywords, strings, variable names — makes code easier to read |
| Code Completion | Autocompletes long function/keyword names — press Enter to accept suggestion |
| Debugging | Set breakpoints (red dots); pause execution at any line; step through line by line |
| Version Control | Git integration built in |
IDE Examples:
- Eclipse, PyCharm, Cloud9 (AWS), Spyder
- VS Code — technically a code editor, but highly configurable to behave like an IDE
Backend frameworks using Python:
- Flask — lightweight
- Django — full-featured
- FastAPI — modern, high-performance
3. Running Python Code
# Basic run
python filename.py
# or
python3 filename.py
- Use any terminal/shell.
- Most Linux distributions have Python pre-installed.
- In Cloud9 or VS Code: use the integrated terminal.
4. AWS Lambda & Python
🟡 AWS CLF-C02 Relevant
- AWS Lambda is a serverless compute service — you only pay for the compute time your code actually uses (not idle time).
- Contrast with EC2: an EC2 instance running 24 hours is billed for 24 hours, even if used for only 1 hour.
- Lambda supports multiple languages: Python, Rust, Java, JavaScript, and others.
- Python is one of the most popular languages for Lambda functions.
Common Lambda trigger example:
- Upload a file to S3 bucket → triggers a Lambda function → Lambda processes the file automatically.
- Last week's exercise: monitored EC2 CPU utilization → triggered email notification via Lambda (could also trigger any Python logic instead).
Python + Shell Scripting:
- Python can execute Bash scripts directly.
- Bash scripting is great for simple automation but not flexible for complex logic.
- Python provides full flexibility for complex tasks while still being easy to learn.
5. Python Basics — Identifiers & Variables
An identifier is any name given to a variable, function, or class.
Rules for Naming:
| Rule | Example |
|---|---|
| Must start with a letter (not a digit) | ✅ my_var, ❌ 1var |
| Can contain letters, digits, and underscores | ✅ var_1, ✅ value2 |
No special characters except underscore _ | ❌ my-var, ❌ my@var |
| Cannot use reserved keywords | ❌ if, for, while, return, import |
| Convention: use lowercase for variable names | ✅ my_name |
| No length limit |
Reserved Keywords (cannot use as variable names):
if, elif, else, for, while, return, import, def, class, None, True, False, and, or, not, in, is, pass, break, continue
Note:
Comments:
# This is a comment — ignored by the interpreter
# Use comments to explain complex logic
6. Data Types
Primitive Types:
| Type | Description | Example |
|---|---|---|
int | Whole numbers (positive or negative) | 4, -100, 3000 |
float | Fractional/decimal numbers | 4.0, 3.14, -0.5 |
bool | True or False only | True, False |
str | Sequence of characters | "hello", 'world' |
Key Notes:
- In Python, single and double quotes are interchangeable for strings — both mean string (unlike C where
' '= char). - Anything inside quotes is a string, even reserved keywords:
"if"is just a string. 4.0is still a float (has a decimal point), not an integer.
Mutable vs Immutable:
| Category | Types | Meaning |
|---|---|---|
| Immutable | int, float, str, tuple, frozenset | Value cannot be changed after assignment |
| Mutable | list, dict, set | Value can be modified after creation |
For strings: you can reassign a variable to a new string, but you cannot change individual characters within an existing string.
Multi-line Strings:
text = """This is
a multi-line
string"""
# Triple quotes automatically add \n (newline) between lines
String Concatenation:
a = "Hello"
b = " World"
print(a + b) # Output: Hello World
7. Type Conversion
x = 10 # int
y = float(x) # converts to 10.0 (float)
z = str(x) # converts to "10" (string)
int(),float(),str()are built-in functions used for type conversion.- Important:
input()always returns a string, even if the user types a number.
number = int(input("Enter a number: ")) # Must wrap with int() to use as number
8. Operators
Arithmetic Operators:
| Operator | Name | Example | Result |
|---|---|---|---|
+ | Addition / String concat | 5 + 3 | 8 |
- | Subtraction | 5 - 3 | 2 |
* | Multiplication | 5 * 3 | 15 |
/ | Division | 10 / 4 | 2.5 |
% | Modulo (remainder) | 11 % 2 | 1 |
** | Power (exponent) | 10 ** 2 | 100 |
// | Integer division (floor) | 10 // 4 | 2 |
//discards the decimal — useful when you want integer output from integer inputs.
Comparison Operators:
<, >, <=, >=, == (equal), != (not equal)
Assignment Shortcut Operators:
x = 10
x += 5 # same as: x = x + 5
x -= 3 # same as: x = x - 3
x *= 2 # same as: x = x * 2
x /= 4 # same as: x = x / 4
Logical Operators:
if x > 5 and x < 10: # both must be True
if x < 5 or x > 20: # either must be True
if not x == 5: # negation
Python uses
and,or,not— not&&,||,!(those are for other languages like JavaScript/Java).
Operator Precedence (high to low):
()— Parentheses**— Power*,/,//,%— Multiplication/Division+,-— Addition/Subtraction
9. User Input & String Formatting
Taking Input:
name = input("What is your name? ")
print(name)
Converting Input to Number:
num1 = int(input("Enter a number: "))
num2 = int(input("Enter another number: "))
print(num1 + num2) # Proper addition, not string concatenation
String Formatting — Three Methods:
Method 1: Concatenation with + (messy, not recommended)
print(str(num1) + " + " + str(num2) + " = " + str(num1 + num2))
Method 2: .format() method
print("{} + {} = {}".format(num1, num2, num1 + num2))
# Curly braces {} are placeholders, replaced in order
Method 3: f-string (recommended, cleanest)
print(f"{num1} + {num2} = {num1 + num2}")
# f before the string = formatted string
10. Composite Data Types
List
- Ordered, mutable collection of items.
- Created with square brackets
[]. - Zero-indexed (first item = index 0).
- Can store mixed types.
# Create a list
my_fruits = ["apple", "banana", "cherry"]
# Access by index
print(my_fruits[0]) # apple
print(my_fruits[-1]) # cherry (last item — Python-specific negative indexing)
# Change a value (mutable)
my_fruits[1] = "pineapple"
# Add items
my_fruits.append("mango") # adds to the end
my_fruits.insert(1, "blueberry") # inserts at index 1
# Remove items
my_fruits.pop(2) # removes item at index 2
my_fruits.pop() # removes last item (no argument)
my_fruits.remove("apple") # removes by value
# Mixed-type list
mixed = [45, 100, 1.02, True, "hello", "world"]
Python-specific: Negative indexing —
-1is the last item,-2is second-to-last, etc. Not available in most other languages.
Index error: Accessing an index that doesn't exist raises a runtime error (
IndexError: list index out of range).
Tuple
- Ordered, immutable collection.
- Created with parentheses
(). - Once created, values cannot be changed (no append, remove, or index assignment).
- Access items the same way as a list (by index).
my_tuple = (1, 2, 3)
print(my_tuple[0]) # 1
print(type(my_tuple)) # <class 'tuple'>
# This will cause an error:
# my_tuple[0] = 99 # TypeError: 'tuple' object does not support item assignment
# You CAN reassign the variable entirely:
my_tuple = (4, 5, 6) # This is fine
Use tuples when you want data that should not change — reduces accidental bugs.
Dictionary
- Key-value pairs (like JSON).
- Created with curly braces
{}and colons:. - Access values using keys, not numeric indices.
- Keys are unique; values do not have to be.
- Equivalent to:
Mapin C++,HashMapin Java,objectin JavaScript.
my_book = {
1: "Book One",
2: "Book Two",
3: "Book Three"
}
print(my_book[3]) # Book Three
# Keys don't have to be numbers
favorite_fruit = {
"Alice": "apple",
"Bob": "mango",
"Carol": "pineapple"
}
print(favorite_fruit["Bob"]) # mango
To find a key by its value, you have to loop manually — there's no built-in reverse lookup.
11. For Loops & Range
# Basic range loop
for i in range(5):
print(i) # prints 0, 1, 2, 3, 4
# range(start, stop) — stop is EXCLUSIVE
for i in range(2, 5):
print(i) # prints 2, 3, 4 (NOT 5)
# Loop through a list directly
for item in my_fruits:
print(item)
# Loop with index using len()
for i in range(len(my_fruits)):
print(my_fruits[i])
# Print item and its type
for item in mixed:
print(f"{item} is of type {type(item)}")
Lower bound is inclusive, upper bound is exclusive in
range().
12. Labs Covered
| Lab | Topic | Status |
|---|---|---|
| Lab 108 | Python Basics | ✅ Done (previous session) |
| Lab 109 | Python Basics | ✅ Done (previous session) |
| Lab 110 | Working with String Data Type (Ex. 1–4) | ✅ Completed today |
| Lab 111 | Working with Lists, Tuples, and Dictionaries | ✅ Completed today |
| Lab 112 | Composite Data Types / Mixed-Type Lists | ✅ Completed today |
| Lab 113–115 | TBD | 🔜 Next session |
Next Session Plan:
- Complete Python Basics slides
- Python Control Flow
- Then return to Labs 113–115
Saturday Session (2–4 PM):
- Review all Python topics
- Practice with LeetCode (easy) or CodeWars problems
13. AWS CLF-C02 Exam Relevance Summary
The following topics from today's lecture are directly or indirectly relevant to the AWS Certified Cloud Practitioner (CLF-C02) exam:
✅ Directly Relevant
AWS Lambda (Serverless Compute)
- Lambda is a serverless, event-driven compute service — a key CLF-C02 topic under the Cloud Technology & Services domain.
- Billing model: You pay only for the compute time consumed (per invocation + duration), not for idle time.
- Contrast with EC2: EC2 bills by the hour/second even when idle; Lambda bills only when code runs.
- Lambda can be triggered by events such as:
- File upload to S3
- CloudWatch alarms (e.g., CPU utilization threshold on EC2)
- API Gateway requests
- Supports multiple runtimes: Python, Node.js, Java, Rust, and more.
Amazon S3 (Simple Storage Service)
- Mentioned as a Lambda trigger source — uploading a file to S3 can invoke a Lambda function.
- S3 is a core CLF-C02 service (storage domain).
Amazon EC2
- Referenced in context of CPU monitoring with CloudWatch.
- EC2 = Infrastructure as a Service (IaaS) — always-on billing vs Lambda's pay-per-use.
- Understanding EC2 vs Lambda billing helps answer cloud economics questions on the exam.
AWS Cloud9
- An AWS-hosted IDE — browser-based development environment running on an EC2 instance.
- Demonstrates the concept of managed services in the cloud.
CloudWatch (Implied)
- CPU utilization monitoring mentioned — this is done via Amazon CloudWatch metrics and alarms.
- CloudWatch is a CLF-C02 topic under monitoring and management.
ℹ️ Indirectly Relevant
| Concept | CLF-C02 Connection |
|---|---|
| Serverless vs server-based billing | Cloud economics, pricing models |
| Cross-platform code (Lambda runtimes) | Flexibility of cloud services |
| Pay-per-use compute | Core cloud value proposition |
| Event-driven architecture (S3 → Lambda) | Cloud architecture best practices |
📝 CLF-C02 Exam Tips Based on Today's Content
- Know the difference between EC2 and Lambda pricing: EC2 = hourly/per-second regardless of use; Lambda = pay only for execution time.
- Lambda use cases: Image processing on S3 upload, real-time file processing, scheduled tasks, responding to CloudWatch alarms.
- Lambda is serverless — no need to provision or manage servers.
- S3 event notifications can trigger Lambda — a common exam scenario.
- CloudWatch is the service used to collect and monitor metrics like CPU utilization.
Notes compiled from lecture — May 13, 2026
AWS/RE/Start Program — Cohort 3: Project CloudIgnite