This code isn't running in the console

Question:

def average(*numbers):
  sum = 0
  for i in numbers:
    sum = sum + i
  print("Average is:",sum/len(numbers))
  average(1,5,11,90)

Current behavior:
Nothing seen in the output

Desired behavior
Output

Repl link:

https://replit.com/@shubhankaracha2/Python#Execute.py

code snippet

This is because your indentation is wrong.
The only call to average() is inside of the function itself. So, unindent line 6.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.