• s5_day1作业


    #1、使用while循环输出1 2 3 4 5 6     8 9 10
    # s=0
    # while s<10:
    #     s+=1
    #     if s==7:
    #         continue
    #     print(s)
    # for i in range(1,11):
    #     if i==7:
    #         continue
    #     print(i)
    #     i += 1
    
    #2、求1-100的所有数的和
    # s=0
    # i=0
    # while i<100:
    #     i+=1
    #     s+=i
    # print(s)
    # s=0
    # for i in range(1,101):
    #     s+=i
    # print(s)
    
    #3、输出 1-100 内的所有奇数
    # s=0
    # while s<100:
    #     s+=1
    #     if s%2==1:
    #         print(s)
    # for i in range(1,101):
    #     if i%2==1:
    #         print(i)
    
    #4、输出 1-100 内的所有偶数
    # s=0
    # while s<100:
    #     s+=1
    #     if s%2==0:
    #         print(s)
    # for i in range(1,101):
    #     if i%2==0:
    #         print(i)
    
    
    #5、求1-2+3-4+5 ... 99的所有数的和
    # s=0
    # i=1
    # while i<100:
    #     if i%2==1:
    #         s+=i
    #     elif i%2==0:
    #         s-=i
    #     i+=1
    # print(s)
    # s=0
    # for i in range(1,100):
    #     if i%2==1:
    #         s+=i
    #     elif i%2==0:
    #         s-=i
    # print(s)
    
    #6、用户登陆(三次机会重试)
    # count=0
    # while count<3:
    #     name=input('请输入用户名 ')
    #     passwd=input('请输入密码 ')
    #     if name=='z' and passwd=='123':
    #         print('登录成功')
    #         break
    #     else:
    #         print('用户名密码错误')
    #         count+=1
    
    
    # 改进版
    # user='z'
    # pwd='123'
    # count=0
    # while count<3:
    #     username=input('请输入用户名 ')
    #     if username == user:
    #         passwd=input('请输入密码 ')
    #         if  passwd==pwd:
    #             print('登陆成功')
    #             break
    #         else:
    #             print('密码错误,请重新输入')
    #             continue
    #     else:
    #         count += 1
    #         print('用户名错误,请重新输入')
    # else:
    #     print('您输错了3次,已锁定')
  • 相关阅读:
    Win7 VS2015环境编译Libpng
    VS2013正确设置DLL环境变量目录的方法
    Win7 VS2013环境编译Squirrel 3.0.7
    docker-compose部署redis
    docker-compose部署nginx
    mysql备份
    docker 清理空间
    centos安装docker
    django整合vue
    部署3主3从redis伪集群
  • 原文地址:https://www.cnblogs.com/z-x-y/p/6958597.html
Copyright © 2020-2023  润新知