Codewars
Practice makes perfect, and here is the dojo
Grade 8 Kyu
Counting true or false in an array
def count_sheeps(sheep):
# Given an array of true and false, count number of trues
count = 0
for i in sheep:
if i is True: # you can even put "if i:"
count+=1
else:
pass
return count
### solution 2 - .count
def count_sheeps(arrayOfSheeps):
return arrayOfSheeps.count(True)
### solution 3 - list comprehension len
def count_sheeps(sheep):
return len([x for x in sheep if x is True])Grade 7 Kyu
Reverse given int string from largest to smallest
# Guide : Manipulator Tips:
Filter integer from List
Disemvowel (Filter vowels)
Printing Complementary DNA given DNA Strand
Manipulating Lists, Iterating Lists
Determine if an integer n, given, is a square (can be square root to a whole number)
Return Sum of 1 to n given integer
Given average of array, find new value to add to hit target newaverage
Grade 6 Kyu
List Comprehension
Last updated