Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions challenge.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ def make_division_by(n):
"""This closure returns a function that returns the division
of an x number by n
"""
# You have to code here!
pass
return lambda x: x / n


def run():
Expand All @@ -22,7 +21,10 @@ def run():

class ClosureSuite(unittest.TestCase):
def test_closure_make_division_by(self):
# Make the closure test here
pass

self.assertEqual(6, make_division_by(3)(18))
self.assertEqual(20, make_division_by(5)(100))
self.assertEqual(3, make_division_by(18)(54))

unittest.main()

run()