from random import * def write_poem(line_array): x = 0 for item in line_array: x = x + 1; print(str(x)) for i in range(x): f = randint(0, x - 1) print(line_array[f]); lines = ['running through the grass', 'I trip', 'I am having fun', 'A snake bites me', 'My butt itches', 'Ouch', 'You are my sunshine', 'Anal ejections', 'Hello kitty', 'Drugs', 'I am alive']; write_poem(lines);
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