by Brendon Thiede
If your computer could talk back to you, what's the first thing you'd want it to say?
Time to get our starter code!

If you forked for a previous workshop, update it first:
git pull in your local folderSee the Setup Guide for details
git clone https://github.com/YOUR-USERNAME/workshops.git
cd workshops/
code .
This opens VS Code in the current folder
Open the integrated terminal (View → Terminal)
python --version
You should see Python 3.10 or higher!
On some systems, use python3 --version instead
cd python-intro/starter-code
python hello.py
You should see a welcome message!
If it works, you're ready to code!
One of the most popular programming languages in the world
Both are great! Just different tools for different jobs.
// JavaScript
let name = "Alex";
console.log("Hello, " + name);
# Python
name = "Alex"
print(f"Hello, {name}")
Python is often considered easier to read
Labeled boxes for storing information
To remember information and use it later!
Just pick a name and use =
name = "Scooby"
snacks = 7
pi = 3.14
No special keywords needed - Python figures it out!
print, if)
# Good names
player_name = "Sam"
current_score = 100
# Bad names
x = "Sam" # What is x?
n = "Sam" # Which name?
my name = "Sam" # Has a space!
Different kinds of information
Text wrapped in quotes
greeting = "Hello, world!"
name = "Scooby"
story = 'Once upon a time...'
Use double quotes " " or single quotes ' '
Integers (whole) and floats (decimal)
age = 13 # integer (int)
score = 100 # integer
pi = 3.14 # float
temperature = 72.5 # float
Can do math with numbers!
True or False values (capitalized!)
is_learning = True
has_finished = False
loves_python = True
Great for yes/no questions!
Open adventure.py and create variables about yourself:
my_name = "put your name here"
my_age = 0 # put your age
is_learning_python = True
Run it: python adventure.py
Seeing what your program is doing
name = "Alex"
print(name)
Output:
Alex
print("Hello!")
print(42)
print(True)
print("Score:", 100)
Output:
Hello!
42
True
Score: 100
The easy way to mix variables and text
Put f before the quotes, variables in {}
name = "Alex"
age = 13
print(f"My name is {name}")
print(f"I am {age} years old")
Output:
My name is Alex
I am 13 years old
Much cleaner than concatenation!
Asking the user questions
Shows a prompt, waits for the user to type, returns their answer
name = input("What is your name? ")
print(f"Hello, {name}!")
Output:
What is your name? Alex
Hello, Alex!
Even if the user types a number, it's text!
# This is a string "13", not the number 13
age = input("How old are you? ")
# Convert to a number with int()
age = int(input("How old are you? "))
Use int() for whole numbers, float() for decimals
Add to your adventure.py:
name = input("What is your name? ")
color = input("What is your favorite color? ")
print(f"Hello, {name}!")
print(f"Great choice - {color} is awesome!")
Run it: python adventure.py
Create an interactive text adventure!
Making decisions in code
choice = input("Go left or right? ")
if choice == "left":
print("You found a treasure chest!")
else:
print("You found a friendly dragon!")
== checks if two things are equal
Python uses spaces to group code together
if choice == "left":
print("This is inside the if")
print("This is also inside the if")
print("This is outside - always runs")
Use 4 spaces (or press Tab) to indent
hero = input("What is your name, adventurer? ")
print(f"{hero} enters the Dark Forest...")
choice = input("Do you take the path or the river? ")
if choice == "path":
print(f"{hero} found a hidden village!")
else:
print(f"{hero} discovered a waterfall!")
Open adventure.py - it has TODO comments to guide you!
Build your adventure step by step:
python adventure.pyEveryone makes mistakes - that's how we learn!
elifYour adventure is unique!
There's no "right" story - be creative!
The goal is to practice variables, input, and if/else
Let's commit to Git!
git add .
git commit -m "Complete text adventure"
git push
Now your work is saved on GitHub!
Who wants to share their adventure?
What surprised you about Python?
What would you add to your adventure with more time?
Advanced Python Coding
Your code will use loops to repeat actions!
You'll use lists to store collections of data!
python