As always, I've attempted this for awhile before I proceed to ask a question on here. I know there are several attempts at answering this, but none really worked for what I needed.

Here are the instructions:

Implement the following three functions (you should use an appropriate looping construct to compute the averages):

```
allNumAvg(numList) : takes a list of numbers and returns the average of all the numbers in the list.
posNumAvg(numList) : takes a list of numbers and returns the average of all the numbers in the list that are greater than zero.
nonPosAvg(numList) : takes a list of numbers and returns the average of all the numbers in the list that are less than or equal to zero.
```

Write a program that asks the user to enter some numbers (positives, negatives and zeros). Your program should NOT ask the user to enter a fixed number of numbers. Also it should NOT ask for the number of numbers the user wants to enter. But rather it should ask the user to enter a few numbers and end with -9999 (a sentinel value). The user can enter the numbers in any order. Your program should NOT ask the user to enter the positive and the negative numbers separately.

Your program then should create a list with the numbers entered (make sure NOT to include the sentinel value (-9999) in this list) and output the list and a dictionary with the following Key-Value pairs (using the input list and the above functions):

```
Key = 'AvgPositive' : Value = the average of all the positive numbers
Key = 'AvgNonPos' : Value = the average of all the non-positive numbers
Key = 'AvgAllNum' : Value = the average of all the numbers
```

Sample run:

Enter a number (-9999 to end): 4

Enter a number (-9999 to end): -3

Enter a number (-9999 to end): -15

Enter a number (-9999 to end): 0

Enter a number (-9999 to end): 10

Enter a number (-9999 to end): 22

Enter a number (-9999 to end): -9999

The list of all numbers entered is:

[4, -3, -15, 0, 10, 22]

The dictionary with averages is:

{'AvgPositive': 12.0, 'AvgNonPos': -6.0, 'AvgAllNum': 3.0}

Here's is my code:

```
a = []
b = []
c = []
dictionary = {}
total = 0
print("Enter positive, negative or zero to determine the average: ")
while(True):
user_input = int(input("Enter a number (-9999 to end): "))
if(user_input == -9999):
break
def allNumAvg(values):
for number in a:
total = total + number
average = sum(total) / len(total)
if user_input > 0 or user_input < 0:
a.append(user_input)
return average
def posNumAvg(values):
for number in b:
total = total + number
average = sum(total) / len(total)
if user_input > 0:
b.append(user_input)
return average
def nonPosAvg(values):
for number in c:
total = total + number
average = sum(total) + len(total)
if user_input < 0:
c.append(user_input)
return average
print("The list of all numbers entered is:")
print(a+b+c)
dictionary = {
"AvgPositive": posNumAvg(values),
"AvgNonPos": nonPosAvg(values),
"AvgAllNum": allNumAvg(values)
}
print("The dictionary with the averages are:")
print(dictionary)
```

My question is how can I implement the averages to be printed from the dictionary since I'm currently getting the error of: `"AvgPositive": posNumAvg(values), NameError: name 'values' is not defined`

. Additionally, how would I get the list of the numbers entered to print?

Thanks!