Three kinds of bug
Python reads the whole file before it runs any of it. Line 1 is missing its colon, which breaks the rules of the language, so nothing runs at all. Python points at the spot: add the colon.
With the colon back, the program starts, then crashes halfway. This is a runtime error, also called an exception. Python stops and prints a traceback: the trail of calls that led to the line that failed.
Read a traceback from the bottom. The last line names the error type, NameError, then the message: 'totl' is not defined. The line above says where: line 5, inside average. It is a typo for total.
Now it runs to the end and prints 3.0, with no error. But the average of 2, 4 and 6 is 4.0. A logic error is the sneakiest bug: Python does exactly what you wrote, not what you meant.
Hunt it down
First make the bug happen on purpose, with a small input you can check by hand. Write down the right answer before you look: (2 + 4 + 6) / 3 = 12 / 3 = 4.0. Every run gives 3.0.
Make the hidden values visible. Add print(total, count) just before the return and run again. It prints 12 4: the total is right, but count is 4, and there are only three numbers.
A debugger shows the same without editing code. Set a breakpoint on line 8 and run: the program pauses before that line, and you can inspect every variable. total is 12, n is 6, count is 4.
Now explain the code, line by line, to a rubber duck or a patient friend. Saying "count starts at 1" out loud, you hear the bug: nothing has been counted yet, so count should start at 0.
Fix and check
Change one thing at a time, then run again. Only line 3 changes, to count = 0. Now count is 3, the print shows 12 3 and the answer is 4.0. Change two things and you cannot tell which helped.
Compare with your note: 4.0, as worked out. Remove the debugging print and the breakpoint, and try one more input, like [5]. A bug is fixed when you see the right answer, not just when the error goes away.
What you would see
;; step 1/10 · Syntax error: no start
$ python3 avg.py
File "avg.py", line 1
def average(nums)
^
SyntaxError: expected ':'
The terminal card is shortened. Python prints the full path of the file, repeats each line of code under its "File" line, and since Python 3.11 marks the exact spot with ^ and ~ characters. Since Python 3.10 a NameError for a near-miss name ends with a hint, here: Did you mean: 'total'?