The code prints x for each element of the loop, but the problem is that it prints the same value of x for all elements, so the same number for everyone.
Instead if inside mydict, instead of x i use sum(value)/ len(value) for key,value in mylist.items(), then the values are printed correctly.
But i want the variable x created in the second line and use them in mydict.
How can i use x inside mydict and correctly print all values for each element of the list?
Important: i don't want to directly write sum(value)/ len(value) for key,value in list.items(), but i would use x
mylist = {('Jack', 'Grace', 8, 9, '15:00'): [0, 1, 1, 5], 
         ('William', 'Dawson', 8, 9, '18:00'): [1, 2, 3, 4], 
         ('Natasha', 'Jonson', 8, 9, '20:45'): [0, 1, 1, 2]
         }
    for key, value in mylist.items():
        x= sum(value)/ len(value)
        mydict = {key:
                x for key,value in mylist.items()}
    print(mydict)
 
    