# msg = "hello egon 666"# for i in msg:# print(i)#练习2# count = 0# while True:# if count > len(msg):# break# print(msg[count])# count += 1#练习3# msg = "hello alex"# print(msg.replace("alex","sb"))#练习4# msg = "/etc/a.txt|365|get"## print(msg.split("/")[1])# print(msg.split("/")[2].split("|")[0])# print(msg.split("/")[2].split("|")[1])# print(msg.split("/")[2].split("|")[2]) #练习5# while True:# msg = input("==>:")# print(msg) #练习6# while True:# name = input("name:").strip()# password = input("password:").strip()# if len(name) ==0 or len(password) == 0:# continue# if password.isdigit():# password = int(password)# if name == "chen" and password == 123:# print("正确")# break#练习7# while True:# msg = input("请输入内容")# if msg.startswith("alex"):# print(msg+"_SB")#练习8tag = Truewhile tag: name = input("请输入姓名:").strip() password = input("请输入密码:").strip() salary = input("请输入工资:").strip() work_mon = input("请输入工作年份:").strip() if len(work_mon) ==0 or (not work_mon.isdigit()) or len(name) == 0 or len(password) ==0 or len(salary) ==0 or (not salary.isdigit()): continue else: #输入成功 # salary = int(salary) while tag: search = input(‘‘‘ 1 查询总工资 2 查询用户身份 3 退出登录 ‘‘‘) if search.isdigit(): search = int(search) if search == 1: print(salary) elif search == 2: if name == "alex": print("super user") elif name == "yuahao" or name == "wupeiqi": print("normal user") else: print("unkown user") continue elif search == 3: tag = False
时间: 2024-11-09 03:19:23