Title: dict.get() example needs clarification · Issue #31 · Akuli/python-tutorial · GitHub
Open Graph Title: dict.get() example needs clarification · Issue #31 · Akuli/python-tutorial
X Title: dict.get() example needs clarification · Issue #31 · Akuli/python-tutorial
Description:
Open Graph Description:
X Description: <Arrinao> sentence = input("Enter a sentence: ") <Arrinao> counts = {} <Arrinao> for word in sentence.split(): <Arrinao> counts[word] = counts.get(word, 0) + 1 <...
Opengraph URL: https://github.com/Akuli/python-tutorial/issues/31
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"dict.get() example needs clarification","articleBody":"```\r\n\u003cArrinao\u003e sentence = input(\"Enter a sentence: \")\r\n\u003cArrinao\u003e counts = {}\r\n\u003cArrinao\u003e for word in sentence.split():\r\n\u003cArrinao\u003e counts[word] = counts.get(word, 0) + 1\r\n\u003cAkuli\u003e two cases: word is not in counts, word is in counts\r\n\u003cAkuli\u003e word not in counts: counts[word] = 0+1\r\n\u003cAkuli\u003e s o when we see it for the first time, set count to 1\r\n\u003cAkuli\u003e and when word is in counts, it does: counts[word] = counts[word] + 1\r\n\u003cAkuli\u003e so when we see a word we already saw before, we increment the count\r\n```","author":{"url":"https://github.com/Akuli","@type":"Person","name":"Akuli"},"datePublished":"2021-06-25T17:18:35.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/31/python-tutorial/issues/31"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7f5017b6-4486-dd63-8ccd-979a3d9e236f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9E3A:3FED9E:BDB210:10B7FA2:696FB98C |
| html-safe-nonce | 97efa2f5cc37db711e747f810c2c7b62de65a2c4b233d202133884b80f31cdcd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RTNBOjNGRUQ5RTpCREIyMTA6MTBCN0ZBMjo2OTZGQjk4QyIsInZpc2l0b3JfaWQiOiI4MDg1MDI2ODg3MjU1ODAxNzIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 66ad189f03a188e264397139f1f91a2ba1aea1afe398daafb808fabe4653d78f |
| hovercard-subject-tag | issue:930363270 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/Akuli/python-tutorial/31/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f51cc246192a98f9b0c74f987cdf8b8f70f519fffb3b330181a3cf63289e51b7/Akuli/python-tutorial/issues/31 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f51cc246192a98f9b0c74f987cdf8b8f70f519fffb3b330181a3cf63289e51b7/Akuli/python-tutorial/issues/31 |
| og:image:alt | |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Akuli |
| hostname | github.com |
| expected-hostname | github.com |
| None | 40ce4030a7db32193be29054756ed7f7eceec3a82973f060300035bdff8cf777 |
| turbo-cache-control | no-preview |
| go-import | github.com/Akuli/python-tutorial git https://github.com/Akuli/python-tutorial.git |
| octolytics-dimension-user_id | 18505570 |
| octolytics-dimension-user_login | Akuli |
| octolytics-dimension-repository_id | 59950284 |
| octolytics-dimension-repository_nwo | Akuli/python-tutorial |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 59950284 |
| octolytics-dimension-repository_network_root_nwo | Akuli/python-tutorial |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1cdcabe0d7ddc4be91a713d57280849e4c89f5cd |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width