python冒泡循环示例_Python | 演示for循环的示例

python冒泡循环示例

Example:

例:

Here, we are running loop for given ranges with various arguments like argument 1,2,3 and reverse order of the loop.

在这里,我们在给定范围的循环中运行各种参数,例如参数1,2,3和循环的相反顺序。

Program:

程序:

print("Type 1")
for i in range(10):  # start=0 , end=10,step=1
    print(i,end="  ")

print("\nType 2")
for i in range(1,11):  # start=1 , end=10,step=1
    print(i,end="  ")

print("\nType 3")
for i in range(1,11,3):  # start=1 , end=10,step=3
    print(i,end="  ")
    
print("\nType 4")
for i in range(10,0,-1):  # start=10 , end=0,step=-1
    print(i,end="  ")

Output

输出量

Type 1
0  1  2  3  4  5  6  7  8  9
Type 2
1  2  3  4  5  6  7  8  9  10
Type 3
1  4  7  10
Type 4
10  9  8  7  6  5  4  3  2  1


翻译自: https://www.includehelp.com/python/for-loop-example.aspx

python冒泡循环示例

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值