Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python] Challenge 7 (Unreviewed) #361

Merged
merged 5 commits into from
Jan 23, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Edits to documentation
  • Loading branch information
sarcodian committed Jan 23, 2017
commit 6c3c2686947d2a1c7bd233103d137ce8faacddc9
Empty file.
5 changes: 5 additions & 0 deletions challenge_7/python/sarcodian/src/challenge_7.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
def missing_int(L):
'''
Ask for a list and return the missing value
'''

sum_n = 0
sum_n_less_1 = 0
Expand All @@ -10,3 +13,5 @@ def missing_int(L):
sum_n_less_1 += i
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try the more pythonic and readable sum(L).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, thanks, didn't know it existed :)


return sum_n - sum_n_less_1


1 change: 0 additions & 1 deletion challenge_7/python/sarcodian/src/challenge_7_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
class TestBinaryMethods(unittest.TestCase):

def test_missingInt(self):
""" Tests from the READ.me """

self.assertEqual(missing_int([1,3,4,0]), 2)
self.assertEqual(missing_int([1,2,3]), 0)
Expand Down