Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
If you call a function with an empty list like this print(find_average([])) This causes the error - ZeroDivisionError: division by zero
As long as the first test and further attempts don't fail it's the correct solution, simple as that. ^.^
As long as the first test and further attempts don't fail its the correct solution, simple as that.
This must surely raise division by 0 on numbers = []
[]
that's an empty list, calling your function like this:find_average()
you're not passing anything.Everytime I try to pass an empty array: find_average()
I get the following error:
TypeError: find_average() missing 1 required positional argument: 'numbers'
So I guess it's not possible to pass an empty array because the array is the only argument for the function... In that case, is it really necessary to account for empty arrays with an if statement?
need to replace len(numbers) with (len(numbers) or 1) to cover empty arrays.
This isn't correct solution. As the case for correct answer in case of empty array(list) is missing.
Yes, but tests are lacking, there is an issue about that raised.
Wouldn't it display an error if len(numbers) = 0 ?
Literally, the exact same words that came out of my mouth.