Question
NEED ALL TEST cases TO PASS Import unittest def pyramid_builder(blocks): ''' given a certain number of blocks how many layers of a pyriamid can mr.
NEED ALL TEST cases TO PASS
Import unittest
def pyramid_builder(blocks): ''' given a certain number of blocks how many layers of a pyriamid can mr. frog build?
a pyramid is built as follows... * -> 1 layer, 1 block
* *** -> 2 layers, 4 blocks
* *** ***** -> 3 layers, 9 blocks
''' pass
# -------------------------------------------------------------- # The Testing # -------------------------------------------------------------- class myTests(unittest.TestCase): def test0(self): self.assertEqual(pyramid_builder(1), 1)
def test1(self): self.assertEqual(pyramid_builder(3), 2)
def test2(self): self.assertEqual(pyramid_builder(6), 3)
def test3(self): self.assertEqual(pyramid_builder(7), 3)
def test4(self): self.assertEqual(pyramid_builder(10), 4)
if __name__ == '__main__': unittest.main(exit=True)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Create a python function Pyramidbuilder that takes the number of blocks as input and retu...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started