Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set your subtitle preferences in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Outline the Steps

00:01 In IDLE, I’ve opened up a new file that I called poetry_generator.py, and that’s where I’m going to write most of the code. And then I also have the IDLE shell open to the left so that I can run the code and play around with it a little in the interactive shell.

00:20 But first, when I get started with a project like that, that has quite a lot of things to keep in mind, certain restrictions, how many of which verb am I supposed to use, what exactly is the structure that I’m going for?

00:30 These types of things are good to take notes of right inside the code. I like to take a couple of short notes as code comments so that then I can fill it up step by step, basically.

00:41 So one thing I remember I need to do is create the words lists.

00:49 I need to select random words from each list.

00:57 It was three nouns, three verbs, three adjectives, then two prepositions, and one adverb. I think I’ll figure it out later if that’s not correct, but I think that these are the actual numbers that I need.

01:20 I also need to decide whether to use a or an for the article, depending on the first letter of the next word.

01:31 I want to create the poem following the suggested structure should look like this. I’m going to use a multiline string here, so I can paste the whole thing in there to start with an article, adjective, noun, et cetera, et cetera.

01:49 I’ll figure out exactly what that means in a moment, but for now, I just have it here as a note. I think this is the structure that I want to follow, and that’s the things that I want to fulfill in order for this poetry generator to run and create poems.

02:05 And with this plan in place, I’m ready to get started with creating the words lists.

Become a Member to join the conversation.