From 48fa8da373e7f48fc6edbe94975a79277d7e67f4 Mon Sep 17 00:00:00 2001 From: kenn Date: Thu, 24 Sep 2026 09:56:28 -0500 Subject: [PATCH] Today's files from your teacher --- boxes.py | 38 ++++++++++++++++++++++++++++++++++++++ madlibs_bear.py | 30 ++++++++++++++++++++++++++++++ madlibs_fox.py | 34 ++++++++++++++++++++++++++++++++++ madlibs_owl.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ ticket.txt | 29 +++++++++++++++++++++++++++++ warmup.py | 7 +++++++ 6 files changed, 182 insertions(+) create mode 100644 boxes.py create mode 100644 madlibs_bear.py create mode 100644 madlibs_fox.py create mode 100644 madlibs_owl.py create mode 100644 ticket.txt create mode 100644 warmup.py diff --git a/boxes.py b/boxes.py new file mode 100644 index 0000000..ad8bf25 --- /dev/null +++ b/boxes.py @@ -0,0 +1,38 @@ +# BOXES +# +# Do NOT run this yet! +# Read each program. Guess what it prints. +# Type your guess after "My guess:" (it is a comment, so Python ignores it). +# Then run it and check. + + +print("--- Program 1 ---") +pet = "cat" +print(pet) +# My guess: + + +print("--- Program 2 ---") +pet = "cat" +print("pet") +# My guess: + + +print("--- Program 3 ---") +pet = "cat" +pet = "dog" +print(pet) +# My guess: + + +print("--- Program 4 ---") +x = 5 +x = 7 +print(x) +# My guess: + + +print("--- Program 5 ---") +name = "Sam" +print("Hi, Sam " + name) +# My guess: diff --git a/madlibs_bear.py b/madlibs_bear.py new file mode 100644 index 0000000..fe078aa --- /dev/null +++ b/madlibs_bear.py @@ -0,0 +1,30 @@ +# MAD LIBS — Bear +# +# You write the questions AND the story. +# +# A box (variable) is made like this: +# name = input("Type a name: ") +# +# A story line uses boxes like this: +# print(f"One day, {name} went to the store.") +# +# Run it with the play button ▶ (top right). + + +# 1. Make at least 5 boxes. Ask for things like an animal, a food, +# a place, a silly word, a number. + + + +# 2. Write your story. At least 4 lines. Use every box at least once. +# Use one box two times. + +print() + + +print("THE END") + + +# BONUS 1: Ask for a number with int(input(...)). +# Do some maths with it inside the story, like {number * 100}. +# BONUS 2: Make the story ask a question in the middle, then keep going. diff --git a/madlibs_fox.py b/madlibs_fox.py new file mode 100644 index 0000000..bea9464 --- /dev/null +++ b/madlibs_fox.py @@ -0,0 +1,34 @@ +# MAD LIBS — Fox +# +# The story is at the bottom. It is already written. +# The story needs words. Each word goes in a box (a variable). +# +# 3 boxes are done for you. 2 are not. +# Find the ____ lines and finish them. Copy the ones that are done. +# If you see NameError: name '____' you missed a blank. +# +# Run it with the play button ▶ (top right). + + +name = input("Type a name: ") +animal = input("Type an animal: ") +food = input("Type a food: ") + +place = ____ # Ask for a place. Copy a line above and change it. +silly_word = ____ # Ask for a silly word. + + +# ----- THE STORY ----- +# The f means: fill in the boxes. +# {animal} means: open the box called animal and put its word here. + +print() +print(f"One day, {name} found a giant {animal} in the {place}.") +print(f"The {animal} was eating {food}.") +print(f"It looked up and yelled, \"{silly_word}!\"") +print(f"So {name} shared the {food}, and they became best friends.") +print("THE END") + + +# BONUS 1: Add one more line to the story. Use one of your boxes in it. +# BONUS 2: Make a new box called color. Use it in the story. diff --git a/madlibs_owl.py b/madlibs_owl.py new file mode 100644 index 0000000..03c1d7c --- /dev/null +++ b/madlibs_owl.py @@ -0,0 +1,44 @@ +# MAD LIBS — Owl +# +# The story is at the bottom. It is already written. +# It needs 5 boxes (variables). You make them. +# +# Here is how one box is made: +# +# name = input("Type a name: ") +# +# Run it with the play button ▶ (top right). + + +# 1. Make a box called name. Ask for a name. +name = input("Type a name: ") + +# 2. Make a box called animal. Ask for an animal. + + +# 3. Make a box called food. Ask for a food. + + +# 4. Make a box called place. Ask for a place. + + +# 5. Make a box called silly_word. Ask for a silly word. + + + +# ----- THE STORY ----- +# The f means: fill in the boxes. +# {animal} means: open the box called animal and put its word here. + +print() +print(f"One day, {name} found a giant {animal} in the {place}.") +print(f"The {animal} was eating {food}.") +print(f"It looked up and yelled, \"{silly_word}!\"") +print(f"So {name} shared the {food}, and they became best friends.") +print("THE END") + + +# BONUS 1: Add two more lines to the story. Use your boxes. +# BONUS 2: Ask for a number, like this: +# number = int(input("Type a number: ")) +# Then use {number * 2} in the story. What happens? diff --git a/ticket.txt b/ticket.txt new file mode 100644 index 0000000..2589bd2 --- /dev/null +++ b/ticket.txt @@ -0,0 +1,29 @@ +EXIT TICKET — Python Day 3 + +Do not run anything. Just read each one and type what it prints. + + +1. + x = 5 + x = 7 + print(x) + +It prints: + + +2. + food = "pizza" + print("food") + +It prints: + + +3. + name = "Mia" + name = "Leo" + print("Hi " + name) + +It prints: + + +Then save point: git add . git commit -m "my ticket" git push diff --git a/warmup.py b/warmup.py new file mode 100644 index 0000000..717d034 --- /dev/null +++ b/warmup.py @@ -0,0 +1,7 @@ +# WARM-UP +# +# No peeking at hello.py! +# Write the 2 lines that ask for a name, and then say hi to that person. +# Then run it. Does it work? + +