primeiro commit com exercicios de Exercism realizados até esta data
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
def egg_count(display_value):
|
||||
number_of_eggs: int = 0
|
||||
weight: int = 1
|
||||
while display_value % weight != display_value:
|
||||
weight *= 2
|
||||
while display_value:
|
||||
if display_value == weight:
|
||||
number_of_eggs += 1
|
||||
display_value -= weight
|
||||
if display_value < weight:
|
||||
weight //= 2
|
||||
continue
|
||||
if display_value % weight:
|
||||
number_of_eggs += 1
|
||||
display_value -= weight
|
||||
weight //= 2
|
||||
return number_of_eggs
|
||||
Reference in New Issue
Block a user