<jupyter_start><jupyter_text>Temperature SensorThere is a temperature sensor in the processor of your company's server. The company wants to analyze the data provided by the sensor to decide if they should change the cooling system for a better one. As changing the cooling system is expensive and you are an excellent data analyst, you can't make a decision without basis. ToolsYou don't necessarily need to use all the tools. Maybe you opt to use some of them or completely different ones, they are given to help you shape the exercise. Programming exercises can be solved in many different ways.1. Data structures: **lists**2. Loops: **list comprehension**3. Functions: **min, max, print, len**4. Conditional statements: **if-elif-else** TasksThe temperatures measured throughout the 24 hours of a day are:<jupyter_code>temperatures_C = [33, 66, 65, 0, 59, 60, 62, 64, 70, 76, 80, 81, 80, 83, 90, 79, 61, 53, 50, 49, 53, 48, 45, 39]<jupyter_output><empty_output><jupyter_text>The first element of the list is the temperature at 12am, the second element is the temperature at 1am, and so on. The company has decided that if one of the following events occurs, then the cooling system needs to be replaced for a new one to avoid damaging the processor.* More than 4 temperatures are greater than or equal to 70ºC.* Any temperature is above 80ºC.* The average temperature exceeds 65ºC.Follow the steps so that you can make the decision. 1. Find the minimum temperature of the day and store it in a variable.<jupyter_code>min_temp = min(temperatures_C)
print (min_temp)<jupyter_output>0<jupyter_text>2. Find the maximum temperature of the day and store it in a variable.<jupyter_code>max_temp = max(temperatures_C)
print (max_temp)<jupyter_output>90<jupyter_text>3. Create a list with the temperatures that are greater than or equal to 70ºC. Store it in a variable.<jupyter_code>big_temps = []
for i in temperatures_C :
    if i >= 70 :
        big_temps.append(i)
print ("Here is the list of higher or equal to 70°C temperatures:", big_temps)<jupyter_output>Here is the list of higher or equal to 70°C temperatures: [70, 76, 80, 81, 80, 83, 90, 79]<jupyter_text>4. Find the average temperature of the day and store it in a variable.<jupyter_code>av_temp = (sum(temperatures_C)/len(temperatures_C))
print ("Average temperature is:", av_temp)<jupyter_output>Average temperature is: 60.25<jupyter_text>5. Imagine that there was a sensor failure at 3am and the data for that specific hour was not recorded. How would you estimate the missing value? Replace the current value of the list at 3am for an estimation.<jupyter_code>#I don't really understand the question, replace it with what ? I guess the average temperature.

temperatures_C[3] = av_temp
print (temperatures_C)
av_temp = (sum(temperatures_C)/len(temperatures_C))
print ("Average temperature is:", av_temp)<jupyter_output>[33, 66, 65, 60.25, 59, 60, 62, 64, 70, 76, 80, 81, 80, 83, 90, 79, 61, 53, 50, 49, 53, 48, 45, 39]
Average temperature is: 62.760416666666664<jupyter_text>6. Bonus: the maintenance staff is from the United States and does not understand the international metric system. Help them by converting the temperatures from Celsius to Fahrenheit.To know more about temperature conversion check this [link](https://en.wikipedia.org/wiki/Conversion_of_units_of_temperature).**Formula**: $F = 1.8 * C + 32$<jupyter_code>temperatures_F = []
import numpy as np
for i in temperatures_C : 
    i = (1.8*i)+32
    np.around(i, decimals=2)
    temperatures_F.append(i)
print ("Here is the new temperatures list, in Fahreneit, for our american friends:", temperatures_F)

# Why is np.around() not working there ?<jupyter_output>Here is the new temperatures list, in Fahreneit, for our american friends: [91.4, 150.8, 149.0, 140.45, 138.2, 140.0, 143.60000000000002, 147.2, 158.0, 168.8, 176.0, 177.8, 176.0, 181.4, 194.0, 174.20000000000002, 141.8, 127.4, 122.0, 120.2, 127.4, 118.4, 113.0, 102.2]<jupyter_text>7. Make a decision!Now it's time to make a decision taking into account what you have seen until now. Remember that if one of the following events occurs, then the cooling system needs to be replaced for a new one to avoid damaging the processor.* More than 4 temperatures are greater than or equal to 70ºC.* Any temperature is above 80ºC.* The average temperature exceeds 65ºC. To make your decision, check if any of the three conditions above is met. You might need to use some of the variables you created in steps 1 to 6. Print a message to show if the cooling system needs to be changed or not.<jupyter_code>if len(big_temps) > 4 : 
    print ("There are more than 4 critical temperatures in the day")
for i in temperatures_C :
    if i > 80 : 
        print ("Over 80°C temperatures exist ...")
        print ("The cooling system definitly needs to be changed !")
        break
if av_temp > 65 :
    print ("Should care about the fact that average temperature is too big")<jupyter_output>There are more than 4 critical temperatures in the day
Over 80°C temperatures exist ...
The cooling system definitly needs to be changed !<jupyter_text>BonusThe company has decided that the decision you made is not valid. They want you to analyze the data again but this time, the conditions that need to be met in order to change the cooling system are different.This time, if one of the following events occurs, then the cooling system needs to be replaced:* The temperature is greater than 70ºC during more than 4 consecutive hours.* Any temperature is above 80ºC.* The average temperature exceeds 65ºC.Follow the steps so that you can make the decision. 1. Create a list with the hours where the temperature is greater than 70ºC. Store it in a variable.<jupyter_code>too_big_t = 0
for i in temperatures_C :
    if i > 70 :
        print (temperatures_C.index(i))<jupyter_output>9
10
11
10
13
14
15<jupyter_text>2. Check if the list you created in step 1 has more than 4 consecutive hours.<jupyter_code>too_big_t = 0
for i in temperatures_C :
    if i > 70 :
        too_big_t +=1
        if too_big_t > 4 :
            print ("The temperature is greater than 70ºC during more than 4 consecutive hours !")
            break<jupyter_output>The temperature is greater than 70ºC during more than 4 consecutive hours !<jupyter_text>3. Make the decision!To make your decision, check if any of the three conditions is met. Print a message to show if the cooling system needs to be changed or not.<jupyter_code>too_big_t = 0
for i in temperatures_C :
    if i > 70 :
        too_big_t +=1
        if too_big_t > 4 :
            print ("The temperature is greater than 70ºC during more than 4 consecutive hours !")
            break
for i in temperatures_C :
    if i > 80 : 
        print ("Over 80°C temperatures exist ...")
        print ("The cooling system definitly needs to be changed !")
        break
        
if av_temp > 65 :
    print ("Should care about the fact that average temperature is too big")<jupyter_output>The temperature is greater than 70ºC during more than 4 consecutive hours !
Over 80°C temperatures exist ...
The cooling system definitly needs to be changed !<jupyter_text>4. Find the average value of the temperature lists (ºC and ºF). What is the relation between both average values?<jupyter_code>av_temp_C = (sum(temperatures_C)/len(temperatures_C))
av_temp_F = (sum(temperatures_F)/len(temperatures_F))

print ("Average temperature in °C :", av_temp_C)
print ("Average temperature in °F :", av_temp_F)

print ("The values respect the basic relation 𝐹=1.8∗𝐶+32")<jupyter_output>Average temperature in °C : 62.760416666666664
Average temperature in °F : 144.96875
The values respect the basic relation 𝐹=1.8∗𝐶+32<jupyter_text>5. Find the standard deviation of the temperature lists (ºC and ºF). What is the relation between both standard deviations?<jupyter_code>import numpy as np
st_dev_C = np.std(temperatures_C)
st_dev_F = np.std(temperatures_F)

print ("Standard deviation for Celsius list is:", st_dev_C)
print ("Standard deviation for Fahreneit list is:", st_dev_F)
print ("The values don't respect the basic relation 𝐹=1.8∗𝐶+32")<jupyter_output>Standard deviation for Celsius list is: 14.641813548637188
Standard deviation for Fahreneit list is: 26.35526438754694
The values don't respect the basic relation 𝐹=1.8∗𝐶+32
{'fraction_non_alphanumeric': 0.07498197548666186, 'fraction_numerical': 0.055034847392453734, 'mean_word_length': 4.390544041450777, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 52, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 13, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '13', 'dir': 'jupyter-structured-clean-dedup', 'id': '276350', 'license': 'Unlicense', 'n_tokens_mistral': 2864, 'n_tokens_neox': 2469, 'n_words': 1141, 'path': 'temperature/temperature.ipynb', 'repo_name': 'MarcM58/bcn-feb-2019-prework', 'size': '8322'}