Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jumabrian - Brian #412

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions jumabrian/count_zeros.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# function takes in an array of integers A and returns the count for zeros in the array

def count_zeros(A)-> int:
count = 0
for num in A:
if num == 0:
count += 1

return 0


# Simple function call for dry run
arr = [1, 0, 5, 6, 0, 2]
result = count_zeros(arr) # 2
print(result)