Skip to content

Commit

Permalink
Better string formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
robincamille committed Jan 24, 2018
1 parent eec5d04 commit d23ce5f
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions plumpoem.py
Expand Up @@ -36,9 +36,23 @@
color_chosen = colors[color_num]['color'].lower()
adjective_chosen = adjectives[adjectives_num].lower()

# Fill in the blanks of the poem
poem = 'I have eaten\nthe %ss\nthat were in\nthe %s\n\nand which\nyou were probably\nsaving\nfor breakfast\n\nForgive me\nthey were delicious\nso %s\nand so %s' \
% (fruit_chosen, room_chosen, color_chosen, adjective_chosen)
# Fill in the blanks of the poem with the randomly chosen items
# \n means line break
# \ at end of line just splits the line so code can be read more easily

poem = 'I have eaten\n\
the {0}s \n\
that were in\n\
the {1} \n\n\
and which\n\
you were probably\n\
saving\n\
for breakfast\n\n\
Forgive me\n\
they were delicious\n\
so {2} \n\
and so {3}' \
.format(fruit_chosen, room_chosen, color_chosen, adjective_chosen)

api.update_status(status=poem)
print(poem)
Expand Down

0 comments on commit d23ce5f

Please sign in to comment.