标签:lex 判断 就是 登陆程序 现在 end 字母 运算符和 技术分享
count=3
while count>0:
count=count-1
print("您还有%s次机会"%(count))
1 username = input(‘please input your username:‘)
2 password = input("please input your password:")
3 if (username == ‘sylar‘) and (password == ‘alex‘):
4 print("恭喜您登陆成功!")
5 else:
6 print("登录失败")
count=3
while count>0:
count=count-1
username = input(‘please input your username:‘)
password = input("please input your password:")
if (username == ‘sylar‘) and (password == ‘alex‘):
print("恭喜您登陆成功!")
break
else:
print("登录失败")
print("您还有%s次机会"%(count))
name=input(‘请输入名字:‘) age=int(input("请输入年龄:")) job=input(‘请输入工作:‘) hobby=input(‘请输入爱好:‘) print(‘‘‘------------ info of %s ----------- Name : %s Age : %d job : %s Hobbie:%s ------------- end --------------‘‘‘%(name,name,age,job,hobby))
#print(3>4 or 4<3 and 1==1) # F #print(1 < 2 and 3 < 4 or 1>2) # T #print(2 > 1 and 3 < 4 or 4 > 5 and 2 < 1) # T #print(1 > 2 and 3 < 4 or 4 > 5 and 2 > 1 or 9 < 8) # F
#print(1 and 2) # 2 #print(0 and 2) # 0 #print(1 and 3) # 3 #print(2 and 3) # 3 #print(2 or 0 or 3) # 2 #print(1 or 3 or 4) # 1 #print(3 and 5 and 0) # 5 0 #print(0 or 0 or 5 or 3) # 5
index = 0 while index < 5: if index == 3: break # break的时候不会执行while后面的else print("旭哥") index = index + 1 else: # 条件不成立. 执行的代码 print("梁姐")
content = input("请输入你的评论:") # 马化腾是特殊字符 if "马化腾" in content: print("非法的") else: print("合法的") # not in 没有出现xxx
标签:lex 判断 就是 登陆程序 现在 end 字母 运算符和 技术分享
原文地址:https://www.cnblogs.com/chyxlj/p/9366064.html