Question 1.
You roll a 6-sided die 10 times. What is the chance of getting 10 sixes?

Question 2.
Take the same problem set-up as before, rolling a fair dice 10 times. What is the
chance that every roll is less than or equal to 5?

2

In [58]:
five_or_less
= 2
five_or_less
Out[58]:
2
In [59]:
_
=
ok
.
grade(
'
q1_2
'
)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Running tests
---------------------------------------------------------------------
Test summary
Passed: 1
Failed: 0
[ooooooooook] 100.0% passed
Question 3.
Assume we are picking a lottery ticket. We must choose three distinct numbers
from 1 to 100 and write them on a ticket. Next, someone picks three numbers one by one, each
time without putting the previous number back in. We win if our numbers are all called.
If we decide to play the game and pick our numbers as 12, 14, and 89, what is the chance that
we win?

Assign
lottery
to either 1, 2, or 3.

3

Test summary
Passed: 1
Failed: 0
[ooooooooook] 100.0% passed
Question 4.
Assume we have two lists, list A and list B. List A contains the numbers [10,20,30],
while list B contains the numbers [10,20,30,40]. We choose one number from list A randomly and
one number from list B randomly. What is the chance that the number we drew from list A is
larger than the number we drew from list B?

1.2
2. Monkeys Typing Shakespeare
(...or at least the string "datascience")
A monkey is banging repeatedly on the keys of a
typewriter. Each time, the monkey is equally likely to hit any of the 26 lowercase letters of the
English alphabet, regardless of what it has hit before. There are no other keys on the keyboard.
Question 1.
Suppose the monkey hits the keyboard 11 times. Compute the chance that the
monkey types the sequence
datascience
. (Call this
datascience_chance
.) Use algebra and type
in an arithmetic equation that Python can evalute.
4

In [70]:
datascience_chance
=
(
1/26
)
**11
datascience_chance
Out[70]:
2.7245398995795435e-16
In [71]:
_
=
ok
.
grade(
'
q2_1
'
)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Running tests
---------------------------------------------------------------------
Test summary
Passed: 1
Failed: 0
[ooooooooook] 100.0% passed
Question 2.
Write a function called
simulate_key_strike
. It should take
no arguments
, and
it should return a random one-character string that is equally likely to be any of the 26 lower-case
English letters.