• API
• FAQ
• Tools
• Archive
daily pastebin goal
56%
SHARE
TWEET

# Untitled

a guest Jan 16th, 2019 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. temperatures = input("temperature data: ").split(",")
2.
3. value_min = float("inf")
4. time_min = 0
5. value_max = float("-inf")
6. time_max = 0
7. faulty_count = 0
8. good_count = 0
9. sum = 0
10.
11. i = 0
12.
13. while(i<len(temperatures)):
14.     if(temperatures[i] == "-"):
15.         faulty_count = faulty_count + 1
16.     else:
17.         aktuell = float(temperatures[i])
18.         if(aktuell>value_max):
19.             value_max = aktuell
20.             time_max = i
21.         if(aktuell<value_min):
22.             value_min = aktuell
23.             time_min = i
24.         if(aktuell > 60):
25.                 faulty_count = faulty_count + 1
26.         else:
27.             good_count = good_count + 1
28.         if(aktuell < -60):
29.             faulty_count = faulty_count + 1
30.         else:
31.             good_count = good_count + 1
32.         sum = sum + aktuell
33.     i = i + 1
34.
35. if(good_count >= 1):
36.     print("maximum temperature: " + str(value_max) + "°C um " + str(time_max) + " Uhr")
37.     print("minimal temperature: " + str(value_min) + "°C um " + str(time_min) + " Uhr")
38.     print("difference: " + str(value_max-value_min) + "°C")
39.     print("average temperature: " + str( sum / (good_count) ) + "°C")
40.     print("unreal temperatures: " + str(faulty_count))
41. else:
42.     print("only unreal temperatures")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top