zoukankan      html  css  js  c++  java
  • python操作符与流程控制

    操作符:

    算术运算: +   -   *  /  %  //   **

    逻辑运算:and or  not  

    身份运算: is     not is

    不可变数据类型:数字  字符串  字典key

    可变数据类型:列表  字典value

    优先级:幂运算>正负号>算术运算>比较运算>逻辑运算

    流程控制:

    if else

    guess = input("猜猜老男孩的年龄:")
    a = int(guess)
    age = 56

    if a == age :
    print ("you get it")
    elif a < age:
    print("too small")
    else:
    print("too big")

    while   break  cuntinue else 

    count = 3
    while count:

    username = input("请输入用户名:")
    password = input("请输入密码:")
    if username == "oldboy" and password == "123":
    print("登陆成功!")
    break
    else:
    count -= 1
    print("错误!还有",count,"次机会!")
    if count == 0:
    print("机会用光了,程序退出")

  • 相关阅读:
    bootstrap
    Bootstrap面试题
    h5+css3 考试题
    less安装与使用
    css3(四)响应式 Web 设计 - 媒体查询
    css3(三)弹性布局
    css3(三)多列布局
    JavaScriptAPI初识
    Bootstrap面试题
    BS初识
  • 原文地址:https://www.cnblogs.com/pythonclass/p/7200614.html
Copyright © 2011-2022 走看看