From ae0b2117dbef8d26dfbd3a7490db3e894bdb8000 Mon Sep 17 00:00:00 2001 From: mertdoganaygun <163443178+mertdoganaygun@users.noreply.github.com> Date: Sun, 5 Jan 2025 17:36:45 +0300 Subject: [PATCH] =?UTF-8?q?pyramid=5Fmert=5Fdo=C4=9Fan=5Fayg=C3=BCn.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "Week03/pyramid_mert_do\304\237an_ayg\303\274n.py" | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 "Week03/pyramid_mert_do\304\237an_ayg\303\274n.py" diff --git "a/Week03/pyramid_mert_do\304\237an_ayg\303\274n.py" "b/Week03/pyramid_mert_do\304\237an_ayg\303\274n.py" new file mode 100644 index 00000000..c0a7183e --- /dev/null +++ "b/Week03/pyramid_mert_do\304\237an_ayg\303\274n.py" @@ -0,0 +1,8 @@ +def find_pyramid_height(total_blocks): + current_height = 0 + for _ in range(total_blocks): + current_height += 1 + if current_height * (current_height + 1) // 2 > total_blocks: + current_height -= 1 + break + return current_height