python 基础一

内容

python 历史

python 简介

 

我的第一个python程序

 

  写出1-100的所有奇数

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

 

  写出1-100的所有偶数

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

 

  设计的第一个登陆系统

user_name = 'Carry on'
user_key = 123456
i = 0

while i < 3:
    i += 1
    name =input('请输入用户名:')
    if name == user_name:
        key = int(input('请输入密码:'))
        if key == user_key:
            print('登陆成功')
            break
        else :
            print('密码输入错误')
    else :
        print('用户名输入错误')

        if i == 3:
            print('密码输入错误三次,系统关闭。')

 

  

    

posted on 2019-01-02 22:40  Carry_on_nova  阅读(192)  评论(0)    收藏  举报