René's URL Explorer Experiment


Title: else字句何时执行 · Issue #2 · magedu/python2016 · GitHub

Open Graph Title: else字句何时执行 · Issue #2 · magedu/python2016

X Title: else字句何时执行 · Issue #2 · magedu/python2016

Description: Hi comyn: 我有一个逻辑问题没有搞懂。 代码如下: for x in range(0, 10, 2): if x % 2 != 0: break else: print('ok') 输出结果:ok 问题: for x in range(0, 10, 2): x的赋值应该是[2, 4, 6, 8],都是偶数,应该不满足if条件,不会break。为什么最终结果会返回ok呢?

Open Graph Description: Hi comyn: 我有一个逻辑问题没有搞懂。 代码如下: for x in range(0, 10, 2): if x % 2 != 0: break else: print('ok') 输出结果:ok 问题: for x in range(0, 10, 2): x的赋值应该是[2, 4, 6, 8],都是偶数,应该不满足if条件,不会break。为什么最终结果会返回ok呢?

X Description: Hi comyn: 我有一个逻辑问题没有搞懂。 代码如下: for x in range(0, 10, 2): if x % 2 != 0: break else: print('ok') 输出结果:ok 问题: for x in range(0, 10, 2): x的赋值应该是[2, 4, 6, 8],都是偶数,应该不满足if条件,不会break。为什么最终结果会返回ok呢?

Opengraph URL: https://github.com/magedu/python2016/issues/2

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"else字句何时执行","articleBody":"Hi comyn:\n    我有一个逻辑问题没有搞懂。\n    代码如下:\n\n``` python\nfor x in range(0, 10, 2):\n    if x % 2 != 0:\n        break\nelse:\n    print('ok')\n```\n\n输出结果:ok\n\n 问题: for x in range(0, 10, 2):  x的赋值应该是[2, 4, 6, 8],都是偶数,应该不满足if条件,不会break。为什么最终结果会返回ok呢?\n","author":{"url":"https://github.com/quinnqi","@type":"Person","name":"quinnqi"},"datePublished":"2016-02-21T06:36:23.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/2/python2016/issues/2"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:165c5b9a-71c6-c305-ab78-d6ab7efa5e7f
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDFEA:361CC5:21345:2C848:6969C4C0
html-safe-nonce5f4ec9547eafe64f047555b5b6e0664614c942ccb7ff34f81715a0ba67765040
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERkVBOjM2MUNDNToyMTM0NToyQzg0ODo2OTY5QzRDMCIsInZpc2l0b3JfaWQiOiI3NTk1NDc0ODY4MTY1NTI2NzIwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac815a3add2424d49fbbc00714a73ec2705704b04504d229fd457de98ab29ad76d
hovercard-subject-tagissue:135169013
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/magedu/python2016/2/issue_layout
twitter:imagehttps://opengraph.githubassets.com/2c2aaf703a17000ef6ae051476eb1f663aefec1657e712d1ac554b5fed44effa/magedu/python2016/issues/2
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/2c2aaf703a17000ef6ae051476eb1f663aefec1657e712d1ac554b5fed44effa/magedu/python2016/issues/2
og:image:altHi comyn: 我有一个逻辑问题没有搞懂。 代码如下: for x in range(0, 10, 2): if x % 2 != 0: break else: print('ok') 输出结果:ok 问题: for x in range(0, 10, 2): x的赋值应该是[2, 4, 6, 8],都是偶数,应该不满足if条件,不会break。为什么最终结果会返回ok呢?
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamequinnqi
hostnamegithub.com
expected-hostnamegithub.com
Noneacedec8b5f975d9e3d494ddd8f949b0b8a0de59d393901e26f73df9dcba80056
turbo-cache-controlno-preview
go-importgithub.com/magedu/python2016 git https://github.com/magedu/python2016.git
octolytics-dimension-user_id17057776
octolytics-dimension-user_loginmagedu
octolytics-dimension-repository_id51684190
octolytics-dimension-repository_nwomagedu/python2016
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id51684190
octolytics-dimension-repository_network_root_nwomagedu/python2016
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release83c08c21cdda978090dc44364b71aa5bc6dcea79
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/magedu/python2016/issues/2#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmagedu%2Fpython2016%2Fissues%2F2
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmagedu%2Fpython2016%2Fissues%2F2
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=magedu%2Fpython2016
Reloadhttps://github.com/magedu/python2016/issues/2
Reloadhttps://github.com/magedu/python2016/issues/2
Reloadhttps://github.com/magedu/python2016/issues/2
magedu https://github.com/magedu
python2016https://github.com/magedu/python2016
Notifications https://github.com/login?return_to=%2Fmagedu%2Fpython2016
Fork 29 https://github.com/login?return_to=%2Fmagedu%2Fpython2016
Star 25 https://github.com/login?return_to=%2Fmagedu%2Fpython2016
Code https://github.com/magedu/python2016
Issues 2 https://github.com/magedu/python2016/issues
Pull requests 3 https://github.com/magedu/python2016/pulls
Actions https://github.com/magedu/python2016/actions
Projects 0 https://github.com/magedu/python2016/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/magedu/python2016/security
Please reload this pagehttps://github.com/magedu/python2016/issues/2
Insights https://github.com/magedu/python2016/pulse
Code https://github.com/magedu/python2016
Issues https://github.com/magedu/python2016/issues
Pull requests https://github.com/magedu/python2016/pulls
Actions https://github.com/magedu/python2016/actions
Projects https://github.com/magedu/python2016/projects
Security https://github.com/magedu/python2016/security
Insights https://github.com/magedu/python2016/pulse
New issuehttps://github.com/login?return_to=https://github.com/magedu/python2016/issues/2
New issuehttps://github.com/login?return_to=https://github.com/magedu/python2016/issues/2
else字句何时执行https://github.com/magedu/python2016/issues/2#top
questionhttps://github.com/magedu/python2016/issues?q=state%3Aopen%20label%3A%22question%22
https://github.com/quinnqi
https://github.com/quinnqi
quinnqihttps://github.com/quinnqi
on Feb 21, 2016https://github.com/magedu/python2016/issues/2#issue-135169013
questionhttps://github.com/magedu/python2016/issues?q=state%3Aopen%20label%3A%22question%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.