python-if判断
Posted 影子
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python-if判断相关的知识,希望对你有一定的参考价值。
# -*- coding:utf-8 -*-
# Author:DliYao
import getpass
‘‘‘
_username = "dengliyao"
_password = "dly"
username = input("username: ")
#password = getpass.getpass("password: ")
password = input("password: ")
if _username == username and _password == password:
print("{name}...登陆成功".format(name=username))
else:
print("用户名或密码错误")
‘‘‘
#用户输入一个年龄进行判断
age_of_oldboy = 20
guess_age = int(input("guess age: "))
if guess_age == age_of_oldboy:
print("正确")
elif guess_age > age_of_oldboy:
print("大了")
else:
print("小于")
以上是关于python-if判断的主要内容,如果未能解决你的问题,请参考以下文章