python练习1
1.创建一个python脚本,实现下面功能:
- 要求用户输入用户名和密码;
- 如果用户名和密码均正确时,显示"welcom to user manage system";
- 如果用户名和密码不正确时,重新输入,最多有三次机会;
- 用户输入超过三次机会后,会报错"你已经登陆过三次,请10min以后再登陆"。
#!/usr/bin/env python
#coding:utf-8
from __future__ import division
_author_ = "wangying"
'''
@author:wangying
@file:hello.py
@contact:[email protected]
@time:6/28/1710:15 AM
@desc
'''
user = 'root'
passwd = 'westos'
count = 0
while count < 4:
username = raw_input('username:')
password = raw_input('password:')
if username == user and password == passwd:
print "welcom to user manage system"
else:
print "username or password is error,please input again"
count += 1
- 要求用户输入用户名和密码;
- 如果用户名和密码均正确时,显示"welcom to user manage system";
- 如果用户名和密码不正确时,重新输入,最多有三次机会;
- 用户输入超过三次机会后,会报错"你已经登陆过三次,请10min以后再登陆"。
#!/usr/bin/env python
#coding:utf-8
from __future__ import division
_author_ = "wangying"
'''
@author:wangying
@file:hello.py
@contact:[email protected]
@time:6/28/1710:15 AM
@desc
'''
user = 'root'
passwd = 'westos'
count = 0
while count < 4:
username = raw_input('username:')
password = raw_input('password:')
if username == user and password == passwd:
print "welcom to user manage system"
else:
print "username or password is error,please input again"
count += 1
print "你已经登陆过三次,请10min以后再登陆"