GitHub PullRequestReviewCommentEvent at 2014-05-07 18:50:17
Repository: sea-c15-python
Actor: miracode
Payload: {"comment":{"url":"https://api.github.com/repos/codefellows/sea-c15-python/pulls/comments/12394941","id":12394941,"diff_hunk":"@@ -0,0 +1,61 @@\n+def fibonacci(n):\n+    \"\"\"Return nth number in the Fibonacci sequence.\"\"\"\n+    # Initialize sequence\n+    seq = [0, 1]\n+    if n == 1:\n+        return 0\n+    elif n == 2:\n+        return 1\n+    for i in range(1, n - 1):\n+        seq.append(seq[i] + seq[i - 1])\n+    return seq[-1]\n+\n+\n+def lucas(n):\n+    \"\"\"Return nth number in the Lucas numbers.\"\"\"\n+    # Initialize sequence\n+    seq = [2, 1]\n+    if n == 1:\n+        return 2\n+    elif n == 2:\n+        return 1\n+    for i in range(1, n - 1):\n+        seq.append(seq[i] + seq[i - 1])\n+    return seq[-1]\n+\n+\n+def sum_series(n, first=0, second=1):\n+    \"\"\"Return nth number in sum series beginning with 'first' and 'second'.\"\"\"\n+    seq = [first, second]\n+    if n == 1:\n+        return first\n+    elif n == 2:\n+        return second\n+    for i in range(1, n - 1):\n+        seq.append(seq[i] + seq[i - 1])\n+    return seq[-1]\n+\n+if __name__ == '__main__':\n+    # Check that fibonacci works\n+    # Sample sequence\n+    fib = [0, 1, 1, 2, 3, 5, 8, 13]\n+    fibtest = True\n+    for i, val in enumerate(fib, start=1):\n+        fibtest = val == fibonacci(i)\n+    if fibtest: print \"fibonacci passed\"\n+\n+    # Check that lucas works\n+    # Sample sequence\n+    luc = [2, 1, 3, 4, 7, 11, 18, 29]\n+    luctest = True\n+    for i, val in enumerate(luc, start=1):\n+        luctest = val == lucas(i)\n+    if luctest: print \"lucas passed\"\n+\n+    # Check that sum_series works for fib and luc\n+    sumtest = True\n+    for i, val in enumerate(fib, start=1):\n+        sumtest = val == fibonacci(i)\n+    for i, val in enumerate(luc, start=1):\n+        sumtest = val == lucas(i)","path":"students/MichelleRascati/series.py","position":null,"original_position":60,"commit_id":"f97299802afdc242c334fc181840e3b7aa8c943b","original_commit_id":"440082eb449ed69a672f38cabcdd4c1299becf8b","user":{"login":"miracode","id":6878378,"avatar_url":"https://avatars.githubusercontent.com/u/6878378?","gravatar_id":"bc5c72d349d826d529689e5cefab0120","url":"https://api.github.com/users/miracode","html_url":"https://github.com/miracode","followers_url":"https://api.github.com/users/miracode/followers","following_url":"https://api.github.com/users/miracode/following{/other_user}","gists_url":"https://api.github.com/users/miracode/gists{/gist_id}","starred_url":"https://api.github.com/users/miracode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miracode/subscriptions","organizations_url":"https://api.github.com/users/miracode/orgs","repos_url":"https://api.github.com/users/miracode/repos","events_url":"https://api.github.com/users/miracode/events{/privacy}","received_events_url":"https://api.github.com/users/miracode/received_events","type":"User","site_admin":false},"body":"Whoops!  Should be fixed now.","created_at":"2014-05-07T18:50:17Z","updated_at":"2014-05-07T18:50:17Z","html_url":"https://github.com/codefellows/sea-c15-python/pull/30#discussion_r12394941","pull_request_url":"https://api.github.com/repos/codefellows/sea-c15-python/pulls/30","_links":{"self":{"href":"https://api.github.com/repos/codefellows/sea-c15-python/pulls/comments/12394941"},"html":{"href":"https://github.com/codefellows/sea-c15-python/pull/30#discussion_r12394941"},"pull_request":{"href":"https://api.github.com/repos/codefellows/sea-c15-python/pulls/30"}}}}