Our random story generator will use a few lists of phrases and every time we run our program, a sentence will be randomly formed by picking phrases from them.
Hey amazing people, today let's build a Random Story Generator using Python.
Our random story generator will use a few lists of phrases and every time we run our program, a sentence will be randomly formed by picking phrases from those lists. Again it's a fun and easy project so let's get into coding.
For this project, as we are going to randomly pick phrases, we need a module that can make our job easy. Any guesses which module I mean?
The random module! random module comes pre-installed with python hence we don't have to manually install it. Let's import it into our project.
Now it's time to define our lists which will contain random phrases.
when = ['A long time ago', 'Yesterday', 'Before you were born', 'In future', 'Before Thanos arrived'] who = ['Shazam', 'Iron Man', 'Batman', 'Superman', 'Captain America'] went = ['Arkham Asylum', 'Gotham City', 'Stark Tower', 'Bat Cave', 'Avengers HQ'] what = ['to eat a lot of cakes', 'to fight for justice', 'to steal ice cream', 'to dance']
Python Programming Tutorials For Beginners
Today you're going to learn how to use Python programming in a way that can ultimately save a lot of space on your drive by removing all the duplicates. We gonna use Python OS remove( ) method to remove the duplicates on our drive. Well, that's simple you just call remove ( ) with a parameter of the name of the file you wanna remove done.
Python GUI Programming Projects using Tkinter and Python 3
Guide to Python Programming Language
Python Hello World Program - Your first step towards Python world. Learn how to create the Hello World Python program in PyCharm.