Why doesn't my code work on my PC, but does on others?

You're defining a function but not calling it, so when you run your code it finishes running before you type anything. Your input it being sent directly to PowerShell, not to your program.

Add this to the bottom of your script:

average()

As others have pointed out, in your except branch you return your result instead of printing it. You probably want to print(sum(nums) / len(nums)) instead.

I also strongly suggest adding a text prompt to more easily distinguish between your program and your shell, e.g.

float(input('Please enter a number: '))