Python
# This code throws when you run it - read the traceback and fix the bug.
def average(nums):
    total = 0
    for i in range(len(nums) + 1):
        total += nums[i]
    return total / len(nums)

print(average([10, 20, 30]))