Example

**Input temperatures**: [4.4, 4.2, 7.0, 12.9, 18.5, 23.5, 26.4, 26.3, 22.5, 16.6, 11.2, 7.3]

**Output mean**: 15.067

**Output standard deviation**: 8.021

Welcome to Project Lovelace! We're still in early development so there are still tons of bugs to find and improvements to make.
If you have any suggestions, complaints, or comments please let us know on Discourse, Discord, or GitHub!

If you live in the tropics, in the rainforest, near the equator or on an island, the temperature doesn't change a huge amount throughout the year. But if you live in the subtropics or temperate zones then you probably get big swings in temperatures between winter and summer. We can use the average and standard deviation to say things about the climate of a city.

The average (or mean) temperature tells us how warm or cold a place is, while the temperature standard deviation tells us how much the temperature varies. For a series of temperature observations $T_1, T_2, \dots, T_n$, the average temperature $\overline{T}$ is calculated as $$ \overline{T} = \frac{T_1 + T_2 + \cdots + T_n}{n} = \frac{1}{n} \sum_{i=1}^n T_i $$ which can then be used to calculated the temperature standard deviation $\sigma_T$ using $$ \sigma_T = \sqrt{\frac{(T_1 - \overline{T})^2 + (T_2 - \overline{T})^2 + \cdots + (T_n - \overline{T})^2}{n}} = \sqrt{\frac{1}{n} \sum_{i=1}^n (T_i - \overline{T})^2} $$

**Input**:
A list of temperatures in degrees Celsius.

**Output**:
The average temperature, and the temperaure standard deviation.

Difficulty | Timesink | ||
---|---|---|---|

Function | temperature_statistics(T) |

You must be logged in to view your submissions.

- We focused on average monthly temperatures but the difference between the warmest temperature in the middle of the day and the coolest temperature in the middle of the night results in a diurnal temperature variation that's also pretty important.
- You probably noticed a seasonal lag between the time of year with the most sunlight, the summer solstice around June 21, and the warmest months which are usually 1-2 months afterwards in July and August. This is because it takes time to warm things up, especially water with it's huge heat capacity. Because of this, cities near lots of water have longer seasonal lags.
- A similar lag happens every day where the warmest part of the day is usually around 3-5pm instead of at solar noon when the sun reaches its highest point. As a result, the warmest part of the day is when the sun is setting and is low enough that the surface has started cooling.
- Wikipedia has a pretty cool list of cities by average temperature.

Let us know what you think about this problem! Was it too hard? Difficult to understand? Also feel free to discuss the problem, ask questions, and post cool stuff on Discourse. You should be able see a discussion thread below. Would be nice if you don't post solutions in there but if you do then please organize and document your code well so others can learn from it.