栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

Python Control Flow Statements

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Python Control Flow Statements

In Python programming, flow control is the order in which statements or blocks of code are executed at runtime baed on a condition.

Control Flow Statements

The flow control statements are divided into three categories:

  1. Conditional statements
  2. Iterative statements
  3. Transfer statements

Conditional Statements

In Python, condition statements act depending on whether a given condition is True or False. You can execute different blocks of codes depending on the outcome of a condition. Condition statements always evaluate to either True or False.

There are three types of confitional statements.

  1. if statement
  2. if-else
  3. if-elif-else
  4. nested if-else 

Iterative Statements

In Python, iterative statements allow us to execute a block of code repeatedly as long as the condition is True. We also call it a loop statements.

Python provides us the following two loop statement to perform some actions repeatedly.

  1. for loop
  2. while loop 

Let's learn each one of them with the examples.

Transfer Statements

In Python, transfer statements are used to alter the program's way of execution in a certain manner. For this purpose, we use three types of transfer statements.

  1. break statement
  2. continue statement
  3. pass statement
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/886586.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号