← Back to challenges

Total Count of Numbers in a MultiDimensional List

PythonHardlanguage_fundamentalsarraysrecursiondata_structuresregex

Instructions

Create a function that takes a multidimensional list and returns the total count of numbers in that list.

Examples

count_number([["", 17.2, 5, "innokodakademija"]]) ➞ 2
# 17.2 and 5.

count_number([[[[[2, 14]]], 2, 3, 4]]) ➞ 5
# 2, 14, 2, 3 and 4.

count_number([["number"]]) ➞ 0

Notes

Input may be a list of numbers, strings and empty lists.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.