import unittest # -------------------------------------------------------------- # Average # -------------------------------------------------------------- def average(start, end) : ''' Assume that start and end are integers. Return the average all of the numbers from start to end inclusive. For example, average(3, 5) returns 4.0, since (3 + 5) / 2 = 4 ''' pass # -------------------------------------------------------------- # The Testing # -------------------------------------------------------------- class myTests(unittest.TestCase): def test1(self): self.assertAlmostEqual(average(3, 5), 4.0, delta=0.00001) def test2(self): self.assertAlmostEqual(average(-5, 5), 0.0, delta=0.00001) def test3(self): self.assertAlmostEqual(average(100, 200), 150, delta=0.00001) if __name__ == '__main__': unittest.main(exit=True)
import unittest
# --------------------------------------------------------------
# Average
# --------------------------------------------------------------
def average(start, end) :
'''
Assume that start and end are integers.
Return the average all of the numbers from start to end inclusive.
For example,
average(3, 5) returns 4.0, since (3 + 5) / 2 = 4
'''
pass
# --------------------------------------------------------------
# The Testing
# --------------------------------------------------------------
class myTests(unittest.TestCase):
def test1(self):
self.assertAlmostEqual(average(3, 5), 4.0, delta=0.00001)
def test2(self):
self.assertAlmostEqual(average(-5, 5), 0.0, delta=0.00001)
def test3(self):
self.assertAlmostEqual(average(100, 200), 150, delta=0.00001)
if __name__ == '__main__':
unittest.main(exit=True)
![](/static/compass_v2/shared-icons/check-mark.png)
We need to define average function in given scenario
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)