Girls Who Code at Home - Python Poetry - Reference Guide
Girls Who Code at Home - Python Poetry - Reference Guide
Python Poetry
Reference Guide
Python Poetry - Reference Guide
In this document you will find sample answers to some of the questions in the activity.
Follow along with the activity and when you see this icon, stop and crosscheck your ideas
here.
If you are having difficulty choosing a poem, don’t forget to explore some of the poems below!
➔ Poets.org
➔ PoetryFoundation.org
➔ ButtonPoetry.com
➔ FamousPoetsAndPoems.com
2
Step 3: Introduction to Python
Use the sample code below to reflect on how to use comments in Python.
Sample Code:
1. # This is a comment
2. print(“Hello World.”)
3. # Here we can write anything without the computer reading our messages
4. message = “hi”
Reflect
Take a moment to review the code snippet above. Which lines of code are comments? How do you
know? Remember, you can refer to the specific lines of code by their line number.
Line #1 and #3 are comments in Python. We know that these two lines are comments because they start
with the a # symbol.
Sample Code:
Sample Code:
Type in an animal.
Bird
4
Step 5: Create a Poem Generator (cont.)
Reflect
When you run your program, what is different about the output section of Replit?
There is a flashing bar in the output window that allows you to type something in.
A print() command lists a string in the output window. An input() command allows the user to type
in feedback to the string.
Variables in Python
Use this table to create variable names for each of the words the user will replace.
Bird animal
Fly verb
Ice cold
Sample Code:
5
Step 6: Displaying the New Poem
You Try: Print your Customized Poem
Below we shared the code for how to complete your program. You can check out our full sample project
for more ideas!
Sample Code:
Step 7: Extensions
Extension 1: Add More Variables into your Poem (5 mins)
Check out our full extension project for more ideas!