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: Github.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:222bc96a-692d-0e0a-5c25-0ce57000f3e3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CBE6:33DDB5:3ECC58:5A4A86:6A61E704 |
| html-safe-nonce | 4662e1884f7a27f6e0184d32fa2374aeb1b44966a5078abaf867a4e36817cfa8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQkU2OjMzRERCNTozRUNDNTg6NUE0QTg2OjZBNjFFNzA0IiwidmlzaXRvcl9pZCI6IjU0ODM1MDE5OTY5MDAyMTQ1MzIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | eba7711ee8f27fc1b77d9aaa5b409f9f7a161f31f1adb73776621b26878b7692 |
| 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 | b2de8c74e5e61e893155ba46ee41bc66170c1644cb795adefa8386d490f7781c |
| 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 | d1866027ded575df8a15c731dd8b9986c9483ceb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width