Learn Python basics and discover how it compares to C# - two powerful languages, different flavors! (Grades K-12)
Session Date: Saturday, April 18, 2026 at 11:00 AM EST
| ๐ง Grades 3-5 | ๐ง Grades 6-8 | ๐ Grades 9-12 | |
|---|---|---|---|
| ๐ Python Syntax | Write simple print statements and variables | Create functions and use loops | Build classes and understand object-oriented concepts |
| ๐ Comparison | Notice differences in how code looks | Translate basic C# to Python | Understand language paradigms and trade-offs |
| ๐ฆ Data Types | Use strings, numbers, and lists | Work with dictionaries and tuples | Implement type hints and understand duck typing |
| ๐ By End | Write a simple Python program that prints and uses variables | Create a program with functions and loops | Build a complete class-based program with Python |
๐ฌ Setup: Show students the same program in C# and Python side-by-side
THE SAME "HELLO WORLD" IN TWO LANGUAGES ๐
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
C# (What we've been learning):
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ using System; โ
โ โ
โ class Program โ
โ { โ
โ static void Main() โ
โ { โ
โ Console.WriteLine("Hello, World!"); โ
โ } โ
โ } โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Lines of code: 9 ๐
Python (What we're learning today):
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ print("Hello, World!") โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Lines of code: 1 ๐
๐ค Discussion: "Python is like texting, C# is like writing a formal letter!"
๐ฌ Questions to Ask:
- What do you notice is different? ๐
- Which one looks easier to read? ๐
- Why might someone choose one over the other? ๐คท
๐ฌ Setup: Students stand in groups, some are "C# code" and some are "Python code"
HOW WE SHOW CODE BLOCKS ๐ฆ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
C# Team (Use your arms as curly braces!):
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ if (happy) ๐ { โ Arms curve OUT โ
โ { โ
โ jump(); ๐ฆ Jump! โ
โ spin(); ๐ Spin! โ
โ } ๐ } โ Arms curve OUT โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Python Team (Use steps forward for indentation!):
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ if happy: ๐ง Stand at start โ
โ jump() ๐ Step forward, then jump! โ
โ spin() ๐ Stay stepped, then spin! โ
โ ๐ง Step back = block ended โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ก Key Insight:
"In Python, HOW FAR you step forward (indentation) is what shows your code blocks - no curly braces needed!"
WHY IS IT CALLED PYTHON? ๐
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ NOT because of the snake!
โ
Named after "Monty Python's Flying Circus"! ๐ช
(A silly British comedy show from the 1970s)
The creator, Guido van Rossum, wanted:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ฏ A FUN name (not boring!) โ
โ ๐ An EASY language to read โ
โ ๐ Programming that feels PLAYFUL โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Python's Philosophy (The Zen of Python):
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ "Beautiful is better than ugly" โ
โ ๐ "Simple is better than complex" โ
โ ๐ "Readability counts" โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
THE BIG PICTURE ๐ผ๏ธ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ C# ๐ โ Python ๐ โ
โโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Created: 2000 โ Created: 1991 โ
โ By: Microsoft โ By: Guido van Rossum โ
โ Uses: Games, Apps, โ Uses: AI, Data Science, โ
โ Web APIs โ Automation, Web โ
โโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Type: Compiled โ Type: Interpreted โ
โ Typing: Static โ Typing: Dynamic โ
โ Blocks: { curly } โ Blocks: indentation โ
โ End lines: semicolon; โ End lines: nothing needed โ
โโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
WHAT DOES THIS MEAN? ๐ค
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Compiled (C#):
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ Your Code โ ๐จ Compiler โ ๐ฟ Program.exe โ
โ โ
โ Like baking a cake ๐ โ
โ You mix ingredients, bake it ONCE, โ
โ then you can eat it whenever! โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Interpreted (Python):
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ Your Code โ ๐ Python reads line by line โ
โ โ
โ Like a live translator ๐ฃ๏ธ โ
โ Translates each sentence as you speak it! โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Session19/
โโโ ๐ README.md โ ๐ You're reading this!
โโโ ๐ hello_python.py โ ๐ Starter Python code
โโโ ๐ csharp_to_python.md โ ๐ Quick reference guide
โโโ ๐ .gitignore โ ๐ Python files to ignore
- โ Python 3 installed (python.org or via your package manager)
- โ VS Code with Python extension
- โ Basic understanding of programming from C# sessions
- โ Excitement to learn something new! ๐
# Open your terminal and type:
python3 --version
# You should see something like:
# Python 3.11.0 โ
INSTALLING PYTHON ๐
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Windows:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 1. Go to python.org/downloads โ
โ 2. Click the big yellow "Download Python" button โ
โ 3. Run the installer โ
โ โ ๏ธ CHECK "Add Python to PATH" at the bottom! โ
โ 4. Click "Install Now" โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Mac:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Option 1: Download from python.org โ
โ Option 2: Use Homebrew: โ
โ brew install python3 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Linux:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Usually pre-installed! If not: โ
โ sudo apt install python3 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
IN VS CODE:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 1. Click Extensions icon (or Ctrl+Shift+X) โ
โ 2. Search "Python" โ
โ 3. Install "Python" by Microsoft โ
โ 4. You're ready! ๐ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# ๐ My First Python Program!
# This is a comment - Python ignores it (just like // in C#)
print("Hello, World!")
print("I'm learning Python! ๐")
print("This is SO much easier than C#!")python3 hello_python.py๐ C# Comparison:
C#: Python:
โโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโ
Console.WriteLine("Hi!"); print("Hi!")
โ No "Console." prefix
โ No semicolon needed
โ Uses regular parentheses
# ๐ฆ Variables in Python - No type declarations needed!
# In C#, you'd write: string name = "Alex";
# In Python, just:
name = "Alex"
age = 13
height = 5.2
is_student = True
print(f"Name: {name}")
print(f"Age: {age}")
print(f"Height: {height} feet")
print(f"Is a student: {is_student}") VARIABLE COMPARISON ๐ฆ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
C# (Must declare types): Python (Types are automatic):
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ string name = "Alex"; โ โ name = "Alex" โ
โ int age = 13; โ โ age = 13 โ
โ double height = 5.2; โ โ height = 5.2 โ
โ bool isStudent = true; โ โ is_student = True โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
Notice: True with capital T!
# ๐ท๏ธ Type Hints - Tell Python what types you EXPECT
# Python won't enforce these, but they help readability!
name: str = "Alex"
age: int = 13
height: float = 5.2
is_student: bool = True
grades: list[int] = [95, 87, 92, 88]
def greet(person_name: str) -> str:
"""Return a greeting message."""
return f"Hello, {person_name}!"
# Even with wrong types, Python runs (but linters will warn you!)
age = "thirteen" # Works, but type hints say this should be int# ๐ค Getting input from the user
# In C#: Console.ReadLine()
# In Python: input()
name = input("What's your name? ")
print(f"Hello, {name}! Welcome to Python! ๐")
# โ ๏ธ Input ALWAYS returns a string!
age_string = input("How old are you? ")
age = int(age_string) # Convert string to integer
print(f"Next year you'll be {age + 1}!") INPUT COMPARISON ๐ค
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
C#:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Console.Write("Enter name: "); โ
โ string name = Console.ReadLine(); โ
โ โ
โ Console.Write("Enter age: "); โ
โ int age = int.Parse(Console.ReadLine()); โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Python:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ name = input("Enter name: ") โ
โ age = int(input("Enter age: ")) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Python combines the prompt AND reading in one step!
# ๐ Making Decisions in Python
age = int(input("Enter your age: "))
# Notice: No parentheses around condition, ends with colon!
if age < 13:
print("You're a kid! ๐ง")
print("Enjoy your childhood!")
elif age < 20: # "elif" instead of "else if"
print("You're a teenager! ๐ง")
elif age < 65:
print("You're an adult! ๐จ")
else:
print("You're a senior! ๐ด")
print("Age check complete!") IF STATEMENT COMPARISON ๐
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
C#: Python:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ if (age < 13) โ โ if age < 13: โ
โ { โ โ print("Kid!") โ
โ Console.WriteLine("Kid"); โ elif age < 20: โ
โ } โ โ print("Teen!") โ
โ else if (age < 20) โ โ else: โ
โ { โ โ print("Adult!") โ
โ Console.WriteLine("Teen"); โ โ
โ } โ โ โ
โ else โ โ โ
โ { โ โ โ
โ Console.WriteLine("Adult"); โ โ
โ } โ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
KEY DIFFERENCES:
โ No parentheses around condition
โ Colon : instead of curly brace {
โ "elif" instead of "else if"
โ Indentation defines the block!
# ๐ For Loops in Python
# Loop through a range of numbers
print("Counting to 5:")
for i in range(1, 6): # 1, 2, 3, 4, 5 (doesn't include 6!)
print(f" {i}")
# Loop through a list
fruits = ["apple", "banana", "cherry"]
print("\nFruits:")
for fruit in fruits:
print(f" ๐ {fruit}")
# C# foreach equivalent - it's the default in Python! FOR LOOP COMPARISON ๐
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
C# (counting): Python (counting):
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ for (int i = 0; i < 5; i++) โ โ for i in range(5): โ
โ { โ โ print(i) โ
โ Console.WriteLine(i); โ โ โ
โ } โ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
C# (foreach): Python (for each):
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ foreach (var f in fruits) โ โ for f in fruits: โ
โ { โ โ print(f) โ
โ Console.WriteLine(f); โ โ โ
โ } โ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# ๐ While Loops
count = 0
while count < 5:
print(f"Count is: {count}")
count += 1 # Same as count = count + 1
print("Done counting!")
# ๐ฎ Simple Guessing Game
import random
secret = random.randint(1, 10)
guess = 0
while guess != secret:
guess = int(input("Guess a number (1-10): "))
if guess < secret:
print("Too low! โฌ๏ธ")
elif guess > secret:
print("Too high! โฌ๏ธ")
print("๐ You got it!")# ๐ Lists in Python
# Creating a list
numbers = [1, 2, 3, 4, 5]
names = ["Alice", "Bob", "Charlie"]
mixed = [1, "hello", 3.14, True] # Python allows mixed types!
# Accessing elements (same as C#!)
print(names[0]) # "Alice"
print(names[-1]) # "Charlie" (last item - Python special!)
# Adding items
names.append("Diana") # Like C# .Add()
print(names) # ["Alice", "Bob", "Charlie", "Diana"]
# Removing items
names.remove("Bob") # Remove by value
print(names) # ["Alice", "Charlie", "Diana"]
# List slicing (Python superpower! ๐ฆธ)
numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
print(numbers[2:5]) # [2, 3, 4] - from index 2 to 4
print(numbers[:3]) # [0, 1, 2] - first 3 items
print(numbers[7:]) # [7, 8, 9] - from index 7 to end
print(numbers[::2]) # [0, 2, 4, 6, 8] - every 2nd item! LIST COMPARISON ๐
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
C#: Python:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ var nums = new List<int> โ โ nums = [1, 2, 3] โ
โ { 1, 2, 3 }; โ โ โ
โ โ โ โ
โ nums.Add(4); โ โ nums.append(4) โ
โ nums.Remove(2); โ โ nums.remove(2) โ
โ nums.Count โ โ len(nums) โ
โ nums[0] โ โ nums[0] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ PYTHON BONUS - Negative Indexing:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ names = ["A", "B", "C", "D"] โ
โ [0] [1] [2] [3] โ Forward index โ
โ [-4] [-3] [-2] [-1] โ Backward index! โ
โ โ
โ names[-1] = "D" (last item!) โ
โ names[-2] = "C" (second to last!) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# ๐ง Functions in Python
# Basic function
def say_hello():
print("Hello! ๐")
say_hello()
# Function with parameters
def greet(name):
print(f"Hello, {name}! ๐")
greet("Alex")
# Function with return value
def add(a, b):
return a + b
result = add(5, 3)
print(f"5 + 3 = {result}")
# Function with default parameter
def greet_with_title(name, title="Friend"):
print(f"Hello, {title} {name}!")
greet_with_title("Alex") # "Hello, Friend Alex!"
greet_with_title("Alex", "Dr.") # "Hello, Dr. Alex!"
# ๐ Grades 9-12: Type hints in functions
def calculate_area(length: float, width: float) -> float:
"""Calculate the area of a rectangle."""
return length * width FUNCTION COMPARISON ๐ง
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
C#: Python:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ void SayHello() โ โ def say_hello(): โ
โ { โ โ print("Hello!") โ
โ Console.WriteLine("Hi");โ โ โ
โ } โ โ โ
โ โ โ โ
โ int Add(int a, int b) โ โ def add(a, b): โ
โ { โ โ return a + b โ
โ return a + b; โ โ โ
โ } โ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
KEY DIFFERENCES:
โ "def" keyword instead of return type
โ No type declarations for parameters
โ Colon : instead of curly braces
โ snake_case naming (say_hello, not SayHello)
# ๐ Dictionaries - Key-Value Pairs
# Creating a dictionary
student = {
"name": "Alex",
"age": 14,
"grade": 8,
"is_enrolled": True
}
# Accessing values
print(student["name"]) # "Alex"
print(student.get("age")) # 14
# Adding/updating values
student["email"] = "alex@school.com" # Add new
student["age"] = 15 # Update existing
# Looping through dictionary
print("\nStudent Info:")
for key, value in student.items():
print(f" {key}: {value}")
# Check if key exists
if "name" in student:
print(f"Found: {student['name']}") DICTIONARY COMPARISON ๐
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
C#: Python:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ var dict = new Dictionary โ โ dict = { โ
โ <string, int> โ โ "apple": 5, โ
โ { โ โ "banana": 3 โ
โ {"apple", 5}, โ โ } โ
โ {"banana", 3} โ โ โ
โ }; โ โ โ
โ โ โ โ
โ dict["cherry"] = 7; โ โ dict["cherry"] = 7 โ
โ dict.ContainsKey("apple") โ โ "apple" in dict โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# ๐๏ธ Classes in Python
class Dog:
"""A simple Dog class."""
# Constructor (like C# constructor)
def __init__(self, name, age):
self.name = name # Instance variable
self.age = age
self.tricks = [] # Empty list
# Method
def bark(self):
print(f"{self.name} says: Woof! ๐")
# Method with parameter
def add_trick(self, trick):
self.tricks.append(trick)
print(f"{self.name} learned {trick}!")
# Method with return
def get_info(self):
return f"{self.name} is {self.age} years old"
# Using the class
buddy = Dog("Buddy", 3)
buddy.bark()
buddy.add_trick("roll over")
buddy.add_trick("fetch")
print(buddy.get_info())
print(f"Tricks: {buddy.tricks}") CLASS COMPARISON ๐๏ธ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
C#: Python:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ class Dog โ โ class Dog: โ
โ { โ โ def __init__(self, name)โ
โ public string Name; โ โ self.name = name โ
โ โ โ โ
โ public Dog(string name) โ โ def bark(self): โ
โ { โ โ print("Woof!") โ
โ Name = name; โ โ โ
โ } โ โ โ
โ โ โ โ
โ public void Bark() โ โ โ
โ { โ โ โ
โ Console.WriteLine();โ โ โ
โ } โ โ โ
โ } โ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
KEY DIFFERENCES:
โ __init__ instead of constructor name
โ self instead of this
โ self is always the first parameter
โ No access modifiers (public/private) by default
Create a program that:
- Asks for the user's name
- Asks for their favorite color
- Prints a personalized message
# YOUR TURN! Fill in the blanks:
name = input("What is your name? ")
color = input("What is your favorite color? ")
# Print a message using both variables
print(f"Hello ____! Your favorite color is ____!")Create a guessing game:
- Generate a random number 1-20
- Let the user guess
- Give hints (higher/lower)
- Count the guesses
import random
# YOUR TURN! Complete this game:
secret = random.randint(1, 20)
guesses = 0
print("I'm thinking of a number between 1 and 20!")
# Add a while loop here that:
# - Gets a guess from the user
# - Tells them if it's too high or too low
# - Stops when they guess correctly
# - Counts how many guesses they tookCreate a Book class that:
- Has title, author, and pages
- Has a method to display info
- Has a method to check if it's long (> 300 pages)
- Create a list of books and display them all
# YOUR TURN! Create the Book class:
class Book:
def __init__(self, title, author, pages):
# Initialize the attributes
pass
def display(self):
# Print book info nicely
pass
def is_long(self):
# Return True if over 300 pages
pass
# Create some books and test your class!Create a program that converts Fahrenheit to Celsius and vice versa.
- Formula: C = (F - 32) ร 5/9
Create a program that:
- Lets users add items to a list
- Lets users remove items
- Shows the current list
- Counts total items
Create a program with:
- A Student class with name and grades list
- Methods to add grades and calculate average
- Store multiple students in a dictionary
- Display all students and their averages
๐ Circle Share - Answer one:
- "Python is easier than C# because..."
- "I like C# better because..."
- "The biggest difference I noticed was..."
- "Indentation instead of curly braces makes me feel..."
- "I want to use Python for..."
| Term | ๐ Kid-Friendly Definition | ๐ป Example |
|---|---|---|
| ๐ Python | A programming language that's easy to read | print("Hello!") |
| ๐ Interpreted | Code runs line by line, no compiling needed | Just run python file.py |
| ๐ Dynamic Typing | Variables can change types anytime | x = 5; x = "hello" |
| ๐ Indentation | Spaces at the start of lines that matter! | 4 spaces = inside a block |
| ๐ง def | Keyword to define a function | def say_hi(): |
| ๐ List | An ordered collection of items | [1, 2, 3, "four"] |
| ๐ Dictionary | Key-value pairs (like a real dictionary!) | {"name": "Alex"} |
| ๐๏ธ class | A blueprint for creating objects | class Dog: |
| ๐จ init | The constructor method in Python | def __init__(self): |
| ๐ค self | Refers to the current object (like this in C#) |
self.name = name |
๐จโ๐ฉโ๐ง Talk to a family member:
"Today I learned Python! It's another programming language like C#, but it looks very different. Python uses indentation to organize code instead of curly braces, and it's used for things like AI and data science!"
๐ Real-world Python uses:
- ๐ค Artificial Intelligence (ChatGPT, image recognition)
- ๐ Data Science (analyzing data, making charts)
- ๐ฎ Game scripting (Minecraft mods!)
- ๐ Websites (Instagram, Spotify backend)
- ๐ฌ Science & Research (NASA, CERN)
๐ค Questions to explore:
- What language would you choose for a video game?
- Why do you think Python is popular for AI?
- Can you think of a project where you'd use Python?
Before you leave, make sure you can:
- โ๏ธ Write and run a basic Python program
- ๐ฆ Create and use variables
- ๐ Use if/elif/else statements
- ๐ Write for and while loops
- ๐ Create and manipulate lists
- ๐ง Define and call functions
- ๐ Explain 3 differences between Python and C#
In Session 20, we'll build a Web API with Python using Flask! ๐ถ๏ธ
YOUR JOURNEY SO FAR ๐บ๏ธ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ ๐ Sessions 1-10: C# Fundamentals & OOP โ
โ ๐ Sessions 11-15: Building Web APIs โ
โ ๐จ Sessions 16-18: Frontend & JavaScript โ
โ ๐ Session 19: Python Basics โโโ YOU ARE HERE! โ
โ ๐ถ๏ธ Session 20: Flask Web APIs โ
โ ๐ญ Session 21: Final Showcase! โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
You're becoming a multi-language programmer! ๐๐๐