#Welcome to the Hello Random story builder for code club! We will help you make a few changes #to this code and create your own random story. You don't need to understand all of this, just #follow the instructions. And if it gets messed up, close the tab and open the link again to #start fresh. Nothing to fear! import random #ignore this #This code is an intro sentence. Change the words inside the quotes to change the sentence. intro = "Once there was a crazy rhinocerous named Roger." #This prints the first sentence. Don't change this! print(intro) #Now we have a loop that runs 4 times. Change the 4 to 10 to make the story longer! for i in range(1,4): #The computer will pick a random number between 1 and 4 (less than 5) rand = random.randrange(1,5) #Depending on the number, a different sentence is added to the story. #You can change the sentences inside the quotes, but don't delete the quotation marks! if rand == 1: action = "Suddenly it started raining tacos and everyone came outside for dinner." elif rand == 2: action = "A pink, fluffy unicorn came streaking across the sky, and the rabbits said wow." elif rand == 3: action = "They let out a sudden belch, and everyone fell to the earth." else: action = "When the tornado came, everyone was running from the fire." print(action) #You're all done! Now click the "Run" button on the top left to see your story below. #Try it a few times to see how your story changes each time!
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question