'How to find the maximum number of a list within a dictionary? [closed]

I was given a dictionary of lists and I must find the maximum number of each list. Then I must print the number of days in a month (in each list), where it is bigger than 63.

In the Internet I found some tutorials on "how to find the maximum number of a list or a dictionary", but nothing for dictionary of lists. I am completely new in Python and I don't know how to do it. Can anyone help me?

LAeq = { 
   'January': [69.1217, 57.9412, 58.3591, 55.6352, 65.3270, 49.4923, 69.7241, 57.1940, 62.5952, 59.7531, 68.3105,
                50.6993, 59.3879, 59.0797, 66.6688, 55.5005, 60.1379, 56.6107, 61.2111, 63.9141, 55.4969],
         
   'Februar': [66.7236, 65.5080, 63.5125, 65.5043, 57.5814, 60.3855, 56.3212, 59.6606, 63.6518, 57.5417,
               59.0162, 57.5641, 56.7740, 57.6438, 60.9367, 55.4134, 62.1721, 69.2990, 64.7102, 60.0408],
         
   'March': [56.5619, 57.2642, 69.4623, 61.2540, 57.8150, 61.9546, 71.5013, 61.6008, 64.0860, 62.5009, 59.2388,
              55.2874, 59.2533, 59.9555, 63.9331, 65.1949, 65.6555, 62.4279, 65.4257, 57.2280, 67.2643, 63.5646],
         
   'April': [59.5095, 63.4426, 60.6221, 66.6581, 68.5991, 71.9279, 54.0175, 53.7794, 58.4777, 61.8002, 65.3808,
             62.5782, 50.8890, 59.4690, 65.1399, 62.1505, 64.8101, 59.8884, 59.9962],
         
   'Mai': [61.9328, 63.0503, 61.9915, 61.5950, 57.6467, 62.8878, 61.6091, 66.6474, 66.9946, 61.9258, 59.1236,
            57.8063, 63.1175, 61.3867, 59.2807, 61.2180, 57.9000, 64.4902, 58.7644, 67.1225, 63.0175],
         
   'June': [63.9679, 55.5254, 61.8469, 64.7028, 56.2315, 59.6689, 61.1631, 54.1344, 62.5758, 65.2308, 56.7024,
            62.7527, 54.4386, 60.8065, 52.9211, 66.6071, 63.0445, 60.8769, 57.1242, 67.3688, 70.8355]
} 


Solution 1:[1]

With the following code, you print the max from each array and the number of days where the value is greater than 63 (Code written as readable as possible):

for k, v in LAeq.items():
    numDaysGreaterThan63 = 0
    for value in v:
        if value > 63:
            numDaysGreaterThan63 = numDaysGreaterThan63 + 1
    print(max(v))
    print(numDaysGreaterThan63)

Solution 2:[2]

for k,vals in LAeq.items():
    print("Mounth %-10s --> max:%-7.4f --> nums > 63 --> %-3s"%
         (k, max(vals), sum(True for v in vals if v>63)))
Mounth January    --> max:69.7241 --> nums > 63 --> 6  
Mounth Februar    --> max:69.2990 --> nums > 63 --> 7  
Mounth March      --> max:71.5013 --> nums > 63 --> 9  
Mounth April      --> max:71.9279 --> nums > 63 --> 7  
Mounth Mai        --> max:67.1225 --> nums > 63 --> 7  
Mounth June       --> max:70.8355 --> nums > 63 --> 7 

This line of code will do the work, but as already written, there is a convention how to ask a question...good luck :)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Lukas Bals
Solution 2 martineau