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!
Temperature variations
You will learn about:
statistics and summing lots of numbers.
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} $$
Average monthly temperatures for five cities. Saskatoon has warm summers and long cold winters so it has the lowest
average temperature out of the five cities and the difference the summer and winter is huge so it also has the
largest temperature variations. Baku is warmer than Saskatoon so it has a higher average temperature and the
seasons aren't as extreme so it has smaller temperature variations. Khartoum is even warmer than Baku with even
smaller variations although it gets cooler in July and August with the arrival of the moist south westerlies.
Singapore has a tropical rainforest climate and small temperature variations. San Juan, being in the Southern
Hemisphere, gets the opposite seasons.
Input:
A list of temperatures in degrees Celsius.
Output:
The average temperature, and the temperaure standard deviation.
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.
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.