• python第二课


    #格式化输出 %占位符,s字符串 d digit数字 %%只是单纯的显示%
    #while else 当while循环被break打断,就不会执生else的结果
    # % s d
    # name = input('请输入姓名')
    # age = input('请输入年龄')
    # height=input('请输入身高')
    # msg = "我叫%s,今年%s 身高%s" %(name,age,height)
    # print(msg)
    # name = input('请输入姓名:')
    # age=input('请输入年龄:')
    # job=input('请输入工作:')
    # hobbie=input('你的爱好:')
    # msg = '''_________info of Ales Li_____________
    # Name :%s
    # Age :%d
    # job :%s
    # Hobbic :%s
    # _______________end____________________'''%(name,int(age),job,hobbie)
    # print(msg)

    # name = input('请输入姓名')
    # age = input('请输入年龄')
    # height=input('请输入身高')
    # msg = "我叫%s,今年%s 身高%s 学习进度3%%" %(name,age,height)#想要100%输出就加%
    # print(msg)
    #and or not
    # x and y x True,则返回y
    # print(2 > 1 and 1 < 4)
    # print(2 > 1 and 1<4 or 2<3 and 9 > 6 or 2 < 4 and 3<2)
    # print(0 or 4 and 3 or 2)
    # print(2 or 1 < 3 and 2)
    # print(1 and 2)
    # print(0 and 2)
    # print(6 or 2>1)
    # print(2 > 1 or 6)
    # print(3 > 1 and 0)

    #计算1-2+3...+99中除了88以外所有数据的总和
    # i=1
    # sum=0
    # while i<100:
    # if i==88:
    # i+=1
    # continue
    # if i%2!=0:
    # sum=sum+i
    # else:
    # sum=sum-i
    # i+=1
    # print(sum)

    
    
  • 相关阅读:
    【爬坑】在 IDEA 中运行 Hadoop 程序 报 winutils.exe 不存在错误解决方案
    【爬坑】Vim 文档加密 & 解密
    Maven 安装配置
    2014/11/23 条件查询
    2014/11/21
    2014/11/20 SQL简单命令
    2014/11/19 SQL Server基础
    7、数组
    6、循环、跳转、异常语句,string类、math、datetime
    5、循环语句、穷举
  • 原文地址:https://www.cnblogs.com/huangjianfeng/p/11181653.html
Copyright © 2020-2023  润新知