首页 > 代码库 > if else流程判断-CLASS-11(Part 1)
if else流程判断-CLASS-11(Part 1)
if判断语句
1 if true: 2 print("true") 3 else: 4 print("false")
猜年龄大小
1 # Author:dd 2 age_of_boy = 56 3 age = int(input("age:")) 4 if age == age_of_boy: 5 print("you got it") 6 elif age > age_of_boy: 7 print("you need guess smaller") 8 else: 9 print("you need guess bigger")
对输入密码进行隐藏显示
1 import getpass 2 passwd = getpass.getpass("input your password:")
1 # Author:dd 2 import getpass 3 4 5 _username = "test" 6 _passwd = "111" 7 8 username = input("username:") 9 passwd = getpass.getpass("passwd:") 10 print(username,passwd) 11 12 if _username == username and _passwd == passwd: 13 print("user {name} login success".format(name=username)) 14 else: 15 print("login failed")
1 # Author:dd 2 import getpass 3 4 5 _username = "test" 6 _passwd = "111" 7 8 username = input("username:") 9 passwd = input("passwd:") 10 11 if _username == username and _passwd == passwd: 12 print("user {name} login success".format(name=username)) 13 else: 14 print("login failed") 15 print("ddd")
if else流程判断-CLASS-11(Part 1)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。