9.13) Challenge 25 - Managing Sample Measurements
Scenario: You have N samples from regular intervals within a sediment core. Samples are numbered from top to bottom of the core. You have to measure your samples in a random order to avoid biases in your results. Unfortunately, the third measurement you do fails and you loose your sample.
To help you manage your results, write a program with the following steps:
- create a list of length N=5 filled in with None values that will store your results
- generate a random sequence in which you have to measure your samples (use the shuffle() function in the package random). shuffle(x) directly modifies the sequence x to shuffle the order of its elements. Hint: import the shuffle function with "from random import shuffle" before using the function
- going through the random sequence, the program will:
- tell you which sample number to measure
- ask you to enter the measurement for that sample number
- if you enter a measurement (e.g. you don’t press enter strait away), store the measurement in the list as a floating number at the position corresponding to its sample number
- print the list of samples ordered by their sample number. (Later we’ll learn how to plot your results on a graph.)
Execute your script and enter some values for your samples, except for the third measurement. Once you’re done, the program should print the result.
Solution: challenge_managing_samples_solution.py