流程控制语句之条件控制2

在vscode中文件重命名: 鼠标放大文件名上,return即可(或者control,在弹出的菜单中选择rename)

在vscode中复制文件:鼠标放大文件名上,cmd+c then cmd+v

在vscode中删除文件:鼠标放大文件名上,cmd+delete

python里没有 || && !

a = 1
b = 2
c = 2

"""
if 条件表达式 只要这里的表达式可以被当作bool值运算即可
"""
if a or b + 1 == c: 
    print("go to left")
else:
    print("go to right")
go to left
"""
判空操作
"""

d = []
if d:
    print("list is null")
else:
    print("list is not null")
account = "scott"
password = "123"

print("请输入用户名:")
"""
input() 用于接收用户终端输入
"""
user_account = input()
print("请输入密码:")
user_password = input()


# 这里不用加(),因为逻辑运算符优先级最低的
if user_account == account and password == user_password: 
    print("登陆成功")
else:
    print("登陆失败")

input

input([prompt]): 用于接收终端用户输入

a = input("请输入用户名:")
b = input("请输入密码:")

results matching ""

    No results matching ""