From 4f238919d868cf12a83b6243101d8f3bc1a4ce38 Mon Sep 17 00:00:00 2001 From: Michael David Date: Mon, 29 Jan 2024 13:12:48 +0100 Subject: [PATCH] Implement zero-counting function in Python --- mickythegeek/count_zeros.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 mickythegeek/count_zeros.py diff --git a/mickythegeek/count_zeros.py b/mickythegeek/count_zeros.py new file mode 100644 index 00000000..b58a00e5 --- /dev/null +++ b/mickythegeek/count_zeros.py @@ -0,0 +1,10 @@ +def CountZeros(A=[]): + arr_of_zeros = [] + for i in A: + if i == 0: + arr_of_zeros.append(i) + + return len(arr_of_zeros) + + +print(CountZeros([88,0,0,0,0,0,0,0,0,6,5,4,3,2,6,6,8,8,89,9,6])) \ No newline at end of file