zoukankan      html  css  js  c++  java
  • python04 while循环

     #下图为到三角:
    num=5 while num>0: tem=num while tem>0: #嵌套循环 print("#",end=" ") tem-=1 print() num-=1

    #a=1000
    b=a

    b=1000
    a=900

    九九乘法表:

    倒序:
    first=9 #second=9 while first>0: tem=1 while tem<=first: # print(tem,"*",first,"=",first*tem,end=" ") print(str(tem)+"*"+str(first)+"="+str(first*tem),end=" ") # 是制表符 是换行 print()默认换行 tem+=1 #print(first,"*",first,"=",first) print() first-=1 正序: first=1 #second=9 while first<=9: tem=1 while tem<=first: # print(tem,"*",first,"=",first*tem,end=" ") print(str(tem)+"*"+str(first)+"="+str(first*tem),end=" ") #第二行是数字强转字符串,通过+连接起来 tem+=1 #print(first,"*",first,"=",first) print() first+=1

    a>b  yi         #>因为旁边有两个数字,所以被称为二幕运算符或者二元运算符。

    not a>b    #not 因为右边只有一个整体,所以被称为一幕运算符或者一元运算符

    #and  not   or 运算符优先级用()来表示。

    while 条件1:

        ..........

        while 条件2:

         ..........

    break 中断某次循环

    continue 跳过当次循环

    #while 循环结构:

    while 判断条件:

      执行语句....

    else:

      执行语句...

    while循环else语句比较特殊,只有正常结束条件(非break)下才会执行。  

  • 相关阅读:
    原型模型
    单例模式
    C# 委托 delegate
    C#泛型
    客户端注册Cannot execute request on any known server解决
    SpringCloud 学习(二)-2 :Securing The Eureka Server
    SpringCloud 学习(二)-1 :服务注册与发现Eureka扩展
    解决网速慢时maven仓库访问慢
    SpringCloud 学习(二) :服务注册与发现Eureka
    SpringCloud版本问题
  • 原文地址:https://www.cnblogs.com/minkillmax/p/7868730.html
Copyright © 2011-2022 走看看