Exercise

# Driving test

Through the next exercises, we will learn how to build a data generating process (DGP) through progressively complex examples.

In this exercise, you will simulate a very simple DGP. Suppose that you are about to take a driving test tomorrow. Based on your own practice and based on data you have gathered, you know that the probability of you passing the test is 90% when it's sunny and only 30% when it's raining. Your local weather station forecasts that there's a 40% chance of rain tomorrow. Based on this information, you want to know what is the probability of you passing the driving test tomorrow.

This is a simple problem and can be solved analytically. Here, you will learn how to model a simple DGP and see how it can be used for simulation.

Instructions 1/2

**undefined XP**

- Write a function
`test_outcome()`

.- Set
`weather`

as`'rain'`

or`'sun'`

depending on the input argument`p_rain`

(the probability of rain). - Set the appropriate probabilities of
`'pass'`

and`'fail'`

in`test_result`

using`weather`

& the dictionary`p_pass`

.

- Set