Browse Source

Create Counting sheep.md

PythonCoder8 3 years ago
parent
commit
a172cbbc48
1 changed files with 16 additions and 0 deletions
  1. 16 0
      8 kyu/Counting sheep.../Counting sheep.md

+ 16 - 0
8 kyu/Counting sheep.../Counting sheep.md

@@ -0,0 +1,16 @@
+# 8 kyu - Counting sheep... - Authored by tfKamran
+
+Consider an array/list of sheep where some sheep may be missing from their place. We need a function that counts the number of sheep present in the array (true means present).
+
+For example,
+
+`[True,  True,  True,  False,
+  True,  True,  True,  True ,
+  True,  False, True,  False,
+  True,  False, False, True ,
+  True,  True,  True,  True ,
+  False, False, True,  True]`
+
+The correct answer would be `17`.
+
+Hint: Don't forget to check for bad values like `null/undefined`.