Title: Python 零基础入门(3/6):条件判断、循环与函数 | wistbean | wistbean
Open Graph Title: Python 零基础入门(3/6):条件判断、循环与函数
X Title: Python 零基础入门(3/6):条件判断、循环与函数
Description: 系统学习 if/elif/else、for/while、break/continue 与函数封装,帮助 Python 新手写出可复用的基础逻辑代码。
Open Graph Description: 系统学习 if/elif/else、for/while、break/continue 与函数封装,帮助 Python 新手写出可复用的基础逻辑代码。
X Description: 系统学习 if/elif/else、for/while、break/continue 与函数封装,帮助 Python 新手写出可复用的基础逻辑代码。
Keywords:
Mail addresses
wistbean.bb@gmail.com
Opengraph URL: https://wistbean.github.io/python-control-flow-functions.html
Generator: Hexo 3.9.0
Domain: wistbean.github.io
{
"@context": "https://schema.org",
"@type": "BlogPosting",
"headline": "Python 零基础入门(3/6):条件判断、循环与函数",
"description": "系统学习 if/elif/else、for/while、break/continue 与函数封装,帮助 Python 新手写出可复用的基础逻辑代码。",
"author": {
"@type": "Person",
"name": "wistbean"
},
"publisher": {
"@type": "Organization",
"name": "wistbean"
},
"datePublished": "2026-03-26T11:10:00+08:00",
"dateModified": "2026-03-26T12:00:00+08:00",
"mainEntityOfPage": "https://wistbean.org/python-control-flow-functions.html",
"inLanguage": "zh-CN"
}
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [
{
"@type": "Question",
"name": "if、elif、else 的执行顺序是什么?",
"acceptedAnswer": {
"@type": "Answer",
"text": "从上到下判断,第一个为真的分支会执行,后续分支不会再判断。"
}
},
{
"@type": "Question",
"name": "for 和 while 应该怎么选?",
"acceptedAnswer": {
"@type": "Answer",
"text": "已知迭代范围优先用 for,未知结束条件(如等待输入)更适合用 while。"
}
},
{
"@type": "Question",
"name": "函数什么时候需要 return?",
"acceptedAnswer": {
"@type": "Answer",
"text": "当你需要把计算结果给外部复用时必须 return;若只打印展示可以不返回。"
}
}
]
}
| google-site-verification | bcJVGqEGcBIay29szBsswzqYxY3qUzWuvu1hfad3-08 |
| theme-color | #B5963F |
| og:type | article |
| og:site_name | wistbean |
| og:locale | zh-CN |
| og:updated_time | 2026-03-26T02:30:00.000Z |
| twitter:card | summary |
Links:
Viewport: width=device-width, initial-scale=1, maximum-scale=1