首页 > 编程语言 >python练习题

python练习题

时间:2022-09-26 18:13:05浏览次数:61  
标签:练习题 flage 登录 python pwd user print input

1.输入账号密码,判断成功,程序退出。判断失败,继续登录输入。

考察点:while和if语句的运用,及flage标志位。

#coding=utf-8;
flage = True;
while  flage:
    user = raw_input("用户名:");
    print user;
    pwd = input("密码:");
    print pwd;
    if user == "tom" and pwd ==123:
        print "登录成功";
        flage = False;
    else:
        print "登录失败";

 

标签:练习题,flage,登录,python,pwd,user,print,input
From: https://www.cnblogs.com/joyware/p/16731867.html

相关文章