UESTION FOUR
Ms Pakiza took a resolution in 2019 -- to be more fitness-conscious and workout better. She decided to spend an average (mean) of at least 60 hours in the gym per month, between January 2019 and December 2019.
Further, she decided to reward or punish herself, based on her results:
a. If she spent 60+ average hours at the gym in 2019, she will buy herself a luxury car, that she will select randomly from Rolls-Royce, Ferrari, Jaguar or Lamborghini.
b. If she somehow spends less than 60 but more than 50 hours at the gym in 2019, she will treat herself with a new smartwatch, again randomly selected from a range of 5 models - Samsung A1, Apple iWatch, Oppo X1, Infinix Smart, Samsung A2.
c. However, if she were to spend less than 50 hours per month on an average, Ms Pakiza will be disappointed and then give up one of her favorite foods -- vanilla icecream, chocolate milkshake, farm-fresh Pizza, iced Latte.
As you can see, Ms Pakiza had put together a very elaborate and detailed fitness regime. Now that 2019 is over, here were her monthly workout hours:
Jan - 66
Feb - 41
Mar - 55
Apr - 68
May - 60
Jun - 60
Jul - 12
Aug - 78
Sep - 58
Oct - 55
Nov - 59
Dec - 61
Write a Python program that can calculate the average (mean) workout hours for 2019/month, and then find out whether Ms Pakiza can buy a new car, or a new smartwatch, or is she going to give up on one food.
можно одной строчкой в интерпретаторе:
sum([66, 41,55,68,60,60,12,78,58,55,59,61])/12
hours = [66, 41,55,68,60,60,12,78,58,55,59,61]
result = sum(hours)/len(hours)
print(hours
res = 0
for i in hours:
res = (res + i) / 2
print(res)
….