diff --git a/Week03/pyramid_sekip_yaman_arslan.py b/Week03/pyramid_sekip_yaman_arslan.py new file mode 100644 index 00000000..5bf0c551 --- /dev/null +++ b/Week03/pyramid_sekip_yaman_arslan.py @@ -0,0 +1,14 @@ +def calculate_pyramid_height(number_of_blocks): + height = 0 + blocks_used = 0 + counter = 1 + while blocks_used < number_of_blocks: + blocks_used += counter + if blocks_used == number_of_blocks: + height = counter + break + elif blocks_used > number_of_blocks: + height = counter - 1 + break + counter += 1 + return height