day1

#!/usr/bin/env python
#_*_coding:utf-8 _*_
'''
name = input("what is your name?")
print("hello"+ name)

#密码不可见
import getpass
pwd = getpass.getpass("请输入密码:")
print("pwd")

#用户登录验证

import getpass
name = input('请输入用户名:')
pwd = getpass.getpass('请输入密码:')
if name == '大王' and pwd == '123':
    print('欢迎,大王!')
else:
    print('用户名或密码错误!')


#猜年龄游戏
counter=0
for i in range(10):
    My_age = 26

    user_input = int(input('input your guess number:'))
    if user_input == My_age:
        print("Congratulations,you got it!")
    elif user_input < My_age:
        print('Think bigger!')
    else:
        print('Think smaller!')
    counter+=1
    print('Counter:',counter)
    if counter>2:
        break
'''

user_name = '大王'
user_pwd = '123'

count = 0
while count < 3:
    name = input("请输入用户名:")
    pwd = input("请输入密码:")
    if user_name == name and user_pwd == pwd:
        print("欢迎,登录成功!")
        break
    else:
        print("用户名或密码错误。请重新输入!")
    count+=1

 

posted @ 2017-04-24 18:46  小世界大不同  阅读(68)  评论(0)    收藏  举报