<p>告诉我,这个金字塔有多少行是完整的,我要做的就是把它编码成多行。在</p>
<p>例如,如果我输入6个方块…我希望它告诉我金字塔的高度是3。(底部3块,上面2块,上面1块)。在</p>
<p>在我的头脑中,我觉得这将类似于一个斐波纳契金字塔,所以我的基础上我的代码。在</p>
<pre><code>blocks = int(input("Enter number of blocks: "))
for i in range(blocks + 1):
for j in range(blocks + 1):
height = j / 2
if height % 2 == 0:
height = height / 2
print(f"The height of the pyramid: {height}")
</code></pre>
<p>这就是我目前所拥有的。。。如果我做数字6或20,这是可行的,但很明显,如果我做1000,它不会给我我想要的结果。我觉得我离我的代码太远了。在</p>