zoukankan      html  css  js  c++  java
  • python 基础应用1

    1、使用while循环输入1 2 3 4 5 6 8 9 10

    n = 0
    while n < 11:
        n = n + 1
        if n == 7:
            continue
        print(n)

     

    n = 0
    while n < 11:
        n = n + 1
        if n == 7:
             pass
         else:
             print(n)

    2、输出1-100内的所有奇数

    count = 1
    while count < 101:
        if count % 2 == 1:
            print(count)
        count += 1

    3、求1-100的所有数的和

    n = 1
    count = 0
    while n < 101:
        count += n
        n += 1
    print(count)

    四、求1-2+3-4+5...+99

    count = 1
    sum = 0
    while count < 100:
        if count % 2 == 0:
            sum -= count
        else:
            sum += count
        count += 1
    print(sum)

    五、用户登录(三次机会重试)

    i = 0
    while i < 3 :
        username = input("请输入账号:")
        password = int( input("请输入密码:"))
        if username == "咸鱼哥" and password == 123:
            print('登录成功')
        else:
            print('登录失败请重新登录')
        i += 1
    i = 0
    while i < 3:
        username = input("请输入账号:")
        password = input("请输入密码:")
        if username == "wws" and password == '123':
            print('登录成功')
            break
        else:
            print('登录失败,您还有 %s 次机会,请重新登录' %(2-i))
    
        i += 1
    用户登录
  • 相关阅读:
    currentColor
    clip:rect()
    webkitAnimationEnd事件与webkitTransitionEnd事件
    正方体旋转demo
    由-webkit-transform-style:preserve-3d;所想
    设置网站的图标
    条件注释判断浏览器
    怎样动态地插入不会暴露给用户的JS文件
    IOC Unity
    C# 线程
  • 原文地址:https://www.cnblogs.com/2584808136-qq-com/p/12732122.html
Copyright © 2011-2022 走看看