Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Calculus Early Transcendentals

Authors: William L. Briggs, Lyle Cochran, Bernard Gillett

2nd edition

321954428, 321954424, 978-0321947345

More Books

Students also viewed these Programming questions

Question

What are models and why are they important?

Answered: 1 week ago