Question 2 take the same problem set up as before

This preview shows page 2 - 5 out of 16 pages.

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?
BEGIN QUESTION name: q1_2 manual: false [5]: five_or_less = 3 # SOLUTION five_or_less [5]: 3 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 from a bowl 2
with numbers from 1 to 100 each time without putting the previous number back in. We win if our numbers are all called in order. If we decide to play the game and pick our numbers as 12, 14, and 89, what is the chance that we win? Our proposed answer: ( 3 100 ) 3 Assign lottery to either 1, 2, or 3. BEGIN QUESTION name: q1_3 manual: false [8]: lottery = 3 # SOLUTION 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?
[11]: list_chances = 2 # SOLUTION 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. This question is inspired by a mathematical theorem called the Infinite monkey theorem ( https:// en.wikipedia.org/wiki/Infinite_monkey_theorem ), which postulates that if you put a monkey in the situation described above for an infinite time, they will eventually type out all of Shakespeare’s works. 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. BEGIN QUESTION name: q2_1 manual: false 3
[1]: datascience_chance = ( 1/26 ) **11 #SOLUTION datascience_chance [1]: 2.7245398995795435e-16 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. BEGIN QUESTION name: q2_2 manual: false

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture