Today's files from your teacher
This commit is contained in:
parent
da123abb9b
commit
48fa8da373
6 changed files with 182 additions and 0 deletions
38
boxes.py
Normal file
38
boxes.py
Normal file
|
|
@ -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:
|
||||
30
madlibs_bear.py
Normal file
30
madlibs_bear.py
Normal file
|
|
@ -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.
|
||||
34
madlibs_fox.py
Normal file
34
madlibs_fox.py
Normal file
|
|
@ -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.
|
||||
44
madlibs_owl.py
Normal file
44
madlibs_owl.py
Normal file
|
|
@ -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?
|
||||
29
ticket.txt
Normal file
29
ticket.txt
Normal file
|
|
@ -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
|
||||
7
warmup.py
Normal file
7
warmup.py
Normal file
|
|
@ -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?
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue