{"action":"created","comment":{"url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/pulls/comments/89722768","pull_request_review_id":10259348,"id":89722768,"diff_hunk":"@@ -0,0 +1,86 @@\n+#!/usr/bin/env python3\n+\"\"\"Nov 27 2016 Mail room Exercise refactoring for testing.\"\"\"\n+import operator\n+donor_dict = {'Alfred Hitchcock': [10, 20, 30],\n+              'Martin Scorsese': [20, 30, 40],\n+              'Steven Spielberg': [40, 20, 30, 10],\n+              'Francis Coppola': [10, 10, 10],\n+              'Ridley Scott': [10, 20, 30, 10]}\n+\n+donor_summary_dict = {}\n+donor_report = []\n+\n+def print_report():\n+    report_header = (\"{0:<30s} {1:<30s} {2:<30s} {3:<30s}\".\n+                     format('Donor Name',\n+                            'Total Amount', 'No.of Donations',\n+                            'Avg.Donation'))\n+\n+\n+    donor_summary_dict = {donorname: [sum(donor_dict[donorname]), len(donor_dict[donorname]), (sum(donor_dict[donorname]) / len(donor_dict[donorname]))] for donorname in donor_dict.keys()}\n+    sorted_donors = sorted(donor_summary_dict.items(),\n+                           key=operator.itemgetter(1), reverse=True)\n+    for donor in (sorted_donors):\n+        donor_report.append(donor[0] + ' ' + str(donor[1][0]) + ' ' + str(donor[1][1]) + ' ' + str(donor[1][2]))\n+    return \"\\n\".join(donor_report)\n+\n+\n+def send_thanks(user_input, d_amount=None):\n+    if (user_input == 'list'):\n+        return(donor_dict)\n+    if user_input in donor_dict.keys():\n+        try:\n+            d_amount = int(d_amount)\n+        except ValueError as error:\n+            return (type(error).__name__)\n+        donor_dict.setdefault(user_input, []).append(d_amount)\n+        return (user_input, donor_dict.get(user_input))\n+    else:\n+        try:\n+            d_amount = int(d_amount)\n+        except ValueError as error:\n+            return (type(error).__name__)","path":"students/smandava/session6/sm_mailroom_refactor.py","position":42,"original_position":42,"commit_id":"6428cd0f9aa7bd7fa5228b66c2e2667dcccc9b6d","original_commit_id":"6428cd0f9aa7bd7fa5228b66c2e2667dcccc9b6d","user":{"login":"PythonCHB","id":1840917,"avatar_url":"https://avatars.githubusercontent.com/u/1840917?v=3","gravatar_id":"","url":"https://api.github.com/users/PythonCHB","html_url":"https://github.com/PythonCHB","followers_url":"https://api.github.com/users/PythonCHB/followers","following_url":"https://api.github.com/users/PythonCHB/following{/other_user}","gists_url":"https://api.github.com/users/PythonCHB/gists{/gist_id}","starred_url":"https://api.github.com/users/PythonCHB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PythonCHB/subscriptions","organizations_url":"https://api.github.com/users/PythonCHB/orgs","repos_url":"https://api.github.com/users/PythonCHB/repos","events_url":"https://api.github.com/users/PythonCHB/events{/privacy}","received_events_url":"https://api.github.com/users/PythonCHB/received_events","type":"User","site_admin":false},"body":"why return the error like this?\r\n\r\nwhat you want is to re-prompt the user for a valid number. If you aren't going to do that in this function, then you can let the exception be raised, and catch it where it is called.","created_at":"2016-11-28T06:17:55Z","updated_at":"2016-11-28T06:24:37Z","html_url":"https://github.com/UWPCE-PythonCert/IntroPython2016/pull/117#discussion_r89722768","pull_request_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/pulls/117","_links":{"self":{"href":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/pulls/comments/89722768"},"html":{"href":"https://github.com/UWPCE-PythonCert/IntroPython2016/pull/117#discussion_r89722768"},"pull_request":{"href":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/pulls/117"}}},"pull_request":{"url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/pulls/117","id":95425505,"html_url":"https://github.com/UWPCE-PythonCert/IntroPython2016/pull/117","diff_url":"https://github.com/UWPCE-PythonCert/IntroPython2016/pull/117.diff","patch_url":"https://github.com/UWPCE-PythonCert/IntroPython2016/pull/117.patch","issue_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/issues/117","number":117,"state":"open","locked":false,"title":"SM: Week6 Homework and lab exercises","user":{"login":"sasimandava","id":22628608,"avatar_url":"https://avatars.githubusercontent.com/u/22628608?v=3","gravatar_id":"","url":"https://api.github.com/users/sasimandava","html_url":"https://github.com/sasimandava","followers_url":"https://api.github.com/users/sasimandava/followers","following_url":"https://api.github.com/users/sasimandava/following{/other_user}","gists_url":"https://api.github.com/users/sasimandava/gists{/gist_id}","starred_url":"https://api.github.com/users/sasimandava/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sasimandava/subscriptions","organizations_url":"https://api.github.com/users/sasimandava/orgs","repos_url":"https://api.github.com/users/sasimandava/repos","events_url":"https://api.github.com/users/sasimandava/events{/privacy}","received_events_url":"https://api.github.com/users/sasimandava/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-28T01:10:01Z","updated_at":"2016-11-28T06:24:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9aab3938aa57a2926857a98a1bd31e829bca7463","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/pulls/117/commits","review_comments_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/pulls/117/comments","review_comment_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/pulls/comments{/number}","comments_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/issues/117/comments","statuses_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/statuses/6428cd0f9aa7bd7fa5228b66c2e2667dcccc9b6d","head":{"label":"sasimandava:master","ref":"master","sha":"6428cd0f9aa7bd7fa5228b66c2e2667dcccc9b6d","user":{"login":"sasimandava","id":22628608,"avatar_url":"https://avatars.githubusercontent.com/u/22628608?v=3","gravatar_id":"","url":"https://api.github.com/users/sasimandava","html_url":"https://github.com/sasimandava","followers_url":"https://api.github.com/users/sasimandava/followers","following_url":"https://api.github.com/users/sasimandava/following{/other_user}","gists_url":"https://api.github.com/users/sasimandava/gists{/gist_id}","starred_url":"https://api.github.com/users/sasimandava/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sasimandava/subscriptions","organizations_url":"https://api.github.com/users/sasimandava/orgs","repos_url":"https://api.github.com/users/sasimandava/repos","events_url":"https://api.github.com/users/sasimandava/events{/privacy}","received_events_url":"https://api.github.com/users/sasimandava/received_events","type":"User","site_admin":false},"repo":{"id":74299703,"name":"IntroPython2016","full_name":"sasimandava/IntroPython2016","owner":{"login":"sasimandava","id":22628608,"avatar_url":"https://avatars.githubusercontent.com/u/22628608?v=3","gravatar_id":"","url":"https://api.github.com/users/sasimandava","html_url":"https://github.com/sasimandava","followers_url":"https://api.github.com/users/sasimandava/followers","following_url":"https://api.github.com/users/sasimandava/following{/other_user}","gists_url":"https://api.github.com/users/sasimandava/gists{/gist_id}","starred_url":"https://api.github.com/users/sasimandava/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sasimandava/subscriptions","organizations_url":"https://api.github.com/users/sasimandava/orgs","repos_url":"https://api.github.com/users/sasimandava/repos","events_url":"https://api.github.com/users/sasimandava/events{/privacy}","received_events_url":"https://api.github.com/users/sasimandava/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sasimandava/IntroPython2016","description":"Student class repository","fork":true,"url":"https://api.github.com/repos/sasimandava/IntroPython2016","forks_url":"https://api.github.com/repos/sasimandava/IntroPython2016/forks","keys_url":"https://api.github.com/repos/sasimandava/IntroPython2016/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sasimandava/IntroPython2016/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sasimandava/IntroPython2016/teams","hooks_url":"https://api.github.com/repos/sasimandava/IntroPython2016/hooks","issue_events_url":"https://api.github.com/repos/sasimandava/IntroPython2016/issues/events{/number}","events_url":"https://api.github.com/repos/sasimandava/IntroPython2016/events","assignees_url":"https://api.github.com/repos/sasimandava/IntroPython2016/assignees{/user}","branches_url":"https://api.github.com/repos/sasimandava/IntroPython2016/branches{/branch}","tags_url":"https://api.github.com/repos/sasimandava/IntroPython2016/tags","blobs_url":"https://api.github.com/repos/sasimandava/IntroPython2016/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sasimandava/IntroPython2016/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sasimandava/IntroPython2016/git/refs{/sha}","trees_url":"https://api.github.com/repos/sasimandava/IntroPython2016/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sasimandava/IntroPython2016/statuses/{sha}","languages_url":"https://api.github.com/repos/sasimandava/IntroPython2016/languages","stargazers_url":"https://api.github.com/repos/sasimandava/IntroPython2016/stargazers","contributors_url":"https://api.github.com/repos/sasimandava/IntroPython2016/contributors","subscribers_url":"https://api.github.com/repos/sasimandava/IntroPython2016/subscribers","subscription_url":"https://api.github.com/repos/sasimandava/IntroPython2016/subscription","commits_url":"https://api.github.com/repos/sasimandava/IntroPython2016/commits{/sha}","git_commits_url":"https://api.github.com/repos/sasimandava/IntroPython2016/git/commits{/sha}","comments_url":"https://api.github.com/repos/sasimandava/IntroPython2016/comments{/number}","issue_comment_url":"https://api.github.com/repos/sasimandava/IntroPython2016/issues/comments{/number}","contents_url":"https://api.github.com/repos/sasimandava/IntroPython2016/contents/{+path}","compare_url":"https://api.github.com/repos/sasimandava/IntroPython2016/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sasimandava/IntroPython2016/merges","archive_url":"https://api.github.com/repos/sasimandava/IntroPython2016/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sasimandava/IntroPython2016/downloads","issues_url":"https://api.github.com/repos/sasimandava/IntroPython2016/issues{/number}","pulls_url":"https://api.github.com/repos/sasimandava/IntroPython2016/pulls{/number}","milestones_url":"https://api.github.com/repos/sasimandava/IntroPython2016/milestones{/number}","notifications_url":"https://api.github.com/repos/sasimandava/IntroPython2016/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sasimandava/IntroPython2016/labels{/name}","releases_url":"https://api.github.com/repos/sasimandava/IntroPython2016/releases{/id}","deployments_url":"https://api.github.com/repos/sasimandava/IntroPython2016/deployments","created_at":"2016-11-20T20:12:03Z","updated_at":"2016-11-20T20:12:05Z","pushed_at":"2016-11-28T01:07:26Z","git_url":"git://github.com/sasimandava/IntroPython2016.git","ssh_url":"git@github.com:sasimandava/IntroPython2016.git","clone_url":"https://github.com/sasimandava/IntroPython2016.git","svn_url":"https://github.com/sasimandava/IntroPython2016","homepage":null,"size":4898,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"UWPCE-PythonCert:master","ref":"master","sha":"a2b4ce5b145766aed9c92bf5a41f5a12abd6380f","user":{"login":"UWPCE-PythonCert","id":5218825,"avatar_url":"https://avatars.githubusercontent.com/u/5218825?v=3","gravatar_id":"","url":"https://api.github.com/users/UWPCE-PythonCert","html_url":"https://github.com/UWPCE-PythonCert","followers_url":"https://api.github.com/users/UWPCE-PythonCert/followers","following_url":"https://api.github.com/users/UWPCE-PythonCert/following{/other_user}","gists_url":"https://api.github.com/users/UWPCE-PythonCert/gists{/gist_id}","starred_url":"https://api.github.com/users/UWPCE-PythonCert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UWPCE-PythonCert/subscriptions","organizations_url":"https://api.github.com/users/UWPCE-PythonCert/orgs","repos_url":"https://api.github.com/users/UWPCE-PythonCert/repos","events_url":"https://api.github.com/users/UWPCE-PythonCert/events{/privacy}","received_events_url":"https://api.github.com/users/UWPCE-PythonCert/received_events","type":"Organization","site_admin":false},"repo":{"id":70018001,"name":"IntroPython2016","full_name":"UWPCE-PythonCert/IntroPython2016","owner":{"login":"UWPCE-PythonCert","id":5218825,"avatar_url":"https://avatars.githubusercontent.com/u/5218825?v=3","gravatar_id":"","url":"https://api.github.com/users/UWPCE-PythonCert","html_url":"https://github.com/UWPCE-PythonCert","followers_url":"https://api.github.com/users/UWPCE-PythonCert/followers","following_url":"https://api.github.com/users/UWPCE-PythonCert/following{/other_user}","gists_url":"https://api.github.com/users/UWPCE-PythonCert/gists{/gist_id}","starred_url":"https://api.github.com/users/UWPCE-PythonCert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UWPCE-PythonCert/subscriptions","organizations_url":"https://api.github.com/users/UWPCE-PythonCert/orgs","repos_url":"https://api.github.com/users/UWPCE-PythonCert/repos","events_url":"https://api.github.com/users/UWPCE-PythonCert/events{/privacy}","received_events_url":"https://api.github.com/users/UWPCE-PythonCert/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/UWPCE-PythonCert/IntroPython2016","description":"Student class repository","fork":false,"url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016","forks_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/forks","keys_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/keys{/key_id}","collaborators_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/teams","hooks_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/hooks","issue_events_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/issues/events{/number}","events_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/events","assignees_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/assignees{/user}","branches_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/branches{/branch}","tags_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/tags","blobs_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/git/refs{/sha}","trees_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/git/trees{/sha}","statuses_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/statuses/{sha}","languages_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/languages","stargazers_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/stargazers","contributors_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/contributors","subscribers_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/subscribers","subscription_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/subscription","commits_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/commits{/sha}","git_commits_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/git/commits{/sha}","comments_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/comments{/number}","issue_comment_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/issues/comments{/number}","contents_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/contents/{+path}","compare_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/compare/{base}...{head}","merges_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/merges","archive_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/downloads","issues_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/issues{/number}","pulls_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/pulls{/number}","milestones_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/milestones{/number}","notifications_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/labels{/name}","releases_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/releases{/id}","deployments_url":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/deployments","created_at":"2016-10-05T00:28:33Z","updated_at":"2016-10-22T02:35:43Z","pushed_at":"2016-11-28T06:12:14Z","git_url":"git://github.com/UWPCE-PythonCert/IntroPython2016.git","ssh_url":"git@github.com:UWPCE-PythonCert/IntroPython2016.git","clone_url":"https://github.com/UWPCE-PythonCert/IntroPython2016.git","svn_url":"https://github.com/UWPCE-PythonCert/IntroPython2016","homepage":null,"size":5156,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":31,"mirror_url":null,"open_issues_count":2,"forks":31,"open_issues":2,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/pulls/117"},"html":{"href":"https://github.com/UWPCE-PythonCert/IntroPython2016/pull/117"},"issue":{"href":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/issues/117"},"comments":{"href":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/issues/117/comments"},"review_comments":{"href":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/pulls/117/comments"},"review_comment":{"href":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/pulls/117/commits"},"statuses":{"href":"https://api.github.com/repos/UWPCE-PythonCert/IntroPython2016/statuses/6428cd0f9aa7bd7fa5228b66c2e2667dcccc9b6d"}}}}
{"actor":{"display_login":"PythonCHB"}}