if

1.用户登录
import getpass
user = 'test'
passwd = '123'

username = input('what is your name?:')
password = getpass.getpass('Please your password:')

if  user == username and passwd == password:
    print('Hello ' + username)
else:
    print('你输入的账户密码错误')
2.猜数字
mynum = 27

guess_num = int(input('input your guess num:'))
if guess_num == mynum:
    print('恭喜你猜对了!')
elif guess_num > mynum:
    print('你猜的数字太大了!')
else:
    print('你猜的数字太小了!')


THE END
分享
二维码
< <上一篇
for
下一篇>>