python中if else流程判断

Posted 四叶草134

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python中if else流程判断相关的知识,希望对你有一定的参考价值。

_username=Lily
_password=123

username=input("username:")
password=input("password:")

if _username==username and _password==password:
    print("Welcome user {name} login....".format(name=username))
else:
    print("Invalid username or password")

输入结果

F:pypyProjectvenvScriptspython.exe F:/py/pyProject/Day3.py
username:Lily
password:123
Welcome user Lily login....

Process finished with exit code 0

 2.

grade_of_Lucy = 85
guess_grade = int(input("guess grade:"))
if guess_grade == grade_of_Lucy:
    print("yes,you got it")
elif guess_grade > grade_of_Lucy:
    print("think bigger")
else:
    print("think smaller")

 

以上是关于python中if else流程判断的主要内容,如果未能解决你的问题,请参考以下文章

python中if else流程判断

Python流程控制

Day1:If else流程判断

python学习笔记(if else流程判断while循环for循环)

python 3 if else 流程判断示例

python-if else流程判断--006