I can't seem to figure out why my averages in the code below are wrong when I use a mix of positive and negative numbers. any help is greatly appreciated, thanks in advance.
my_num = []
while True:
n = input("Enter a number (-9999 to end):")
if n == '-9999':
break # if user enters -9999 it will come out of loop
my_num.append(int(n)) # adding the numbers with append function
avg = sum(my_num)/len(my_num) #using sum and len function to determine averages
avgpos = sum([ x for x in my_num if x>=0 ])/len(my_num)
avgneg = sum([ x for x in my_num if x<0 ])/len(my_num)
print("the list of all numbers entered are:")
print(my_num)
print("The dictionary with averages is:")
my_dict = {'AvgPositive': avgpos, 'AvgNonPos': avgneg, 'AvgAllNum': avg}
print(my_dict)