# Even/Odd Positions

a guest
Jul 3rd, 2021
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. import sys
2. n = int(input())
3. OddSum = 0
4. EvenSum = 0
5. OddMin = sys.maxsize
6. OddMax = -sys.maxsize
7. EvenMin = sys.maxsize
8. EvenMax = -sys.maxsize
9. for i in range(1, n+1):
10. num = float(input())
11. if i%2 == 0:
12. EvenSum += num
13. if num > EvenMax:
14. EvenMax = num
15. if num < EvenMin:
16. EvenMin = num
17.
18. else:
19. OddSum += num
20. if num > OddMax:
21. OddMax = num
22. if num < OddMin:
23. OddMin = num
24. print (f"OddSum={OddSum: .2f},")
25. if OddMin != sys.maxsize:
26. print(f"OddMin={OddMin: .2f},")
27. else:
28. print("No")
29.
30. if OddMax != -sys.maxsize:
31. print(f"OddMax={OddMax: .2f},")
32. else:
33. print("No")
34.
35. print (f"EvenSum={EvenSum: .2f},")
36. if EvenMin != sys.maxsize:
37. print(f"EvenMin={EvenMin: .2f}")
38. else:
39. print("No")
40. if EvenMax != -sys.maxsize:
41. print(f"EvenMax={EvenMax: .2f}")
42. else:
43. print("No")
44.
45.
46.
47.
48.
49.