4. (Monkeys and Shakespeare, 15pt) The story goes that if a bunch of monkeys sta
ID: 3880316 • Letter: 4
Question
4. (Monkeys and Shakespeare, 15pt) The story goes that if a bunch of monkeys start typing away at some typewriters (what we call keyboards now), they'll eventually produce all of Shakespeare works (since the odds are positive, so if you wait long enough itll happen). We don't have enough time and resources to test this theory, so we'll work with a simplified version. a) [5pt] Write a function randline(I) that creates a random line made up of letters t, 'o', b', e', r, 'n, and and ends in a n. Here are some sample runs: Python 3.5.2 Shell File Edit Shell Debug Options Window Help >>>randline (10) 'ttn b rtrr ' >>> randline (20) 'brnbnbbrrrr no bo rn ' >>>randline (30) obb rtoortnronror rbbr bbtbbb ' 1 Ln: 106 Col:4 Hint: research the choice method in random to help you make the random selection.Explanation / Answer
Program B)
Program-C)
**Comment for any further queries.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.