import getpass# print("hello word") ## name= ‘pangxiao‘# mix_name=name# print(mix_name,name)# print(2**8)# name= "pangxiao"# age=26# sex="男"# salary= 3000## name=input("name:")# age=input("age:")# sex=input("sex:")# salary=input("salary:") # info = """# ---------info of# name: %s# age: %s# sex: %s# salary: %s## """ %(name,age,sex,salary)# print(info) # info2 = """# ---------info2 of# name: {_name}# age: {_age}# sex: {_sex}# salary: {_salary}## """ .format(_name=name,_age=age,_sex=sex,_salary=salary)# print(info2) # name3=input("name:")# password3=getpass.getpass("password:")# print(name3,password3)# _name="pangxiao"# _password="abc123"# name3=input("name:")# password3=input("password:")# if _name == name3 and _password == password3:# print("登录成功!{username}".format(username=name3))# else:# print("登录失败请重新登录!")#自己写的小例子dapangxiaozi = 26count=5 while count: guess_age = int(input("gusee_age:")) if guess_age == dapangxiaozi: print("猜对了") break elif guess_age > dapangxiaozi: count -=1 print("猜高了,再小点!,还有{}次机会".format(count)) continue else: count -=1 print("猜小了,再大点!还有{}次机会".format(count)) continue
原文地址:https://www.cnblogs.com/fuyuteng/p/12005121.html
时间: 2024-10-06 00:53:25