Q:

A function that checks the average of dict items

I'm trying to send a dictionary into a function that caculated the average, I believe my function is good but I'm having trouble with sending the dictionary
my_dict = {"first": 100, "second": 0, "third": 200}

def avg(dict):

    sum=0
    count=0
    for k,v in dict:
        sum = sum+v
        count +=1
    return(sum/count)

result = avg(**my_dict)

print(result)

The output should be 100 that goes into "result"

A:

my_dict = {"first": 100, "second": 0, "third": 200}
def dictavg(your_dict):
    return sum(your_dict.values())/len(your_dict)
print(dictavg(my_dict))

