实现用户输入用户名和密码,当用户名为 seven 且密码为 123 时,显示登陆成功,否则登陆失败,失败时允许重复输入三次;
user_name = "seven" user_password = "123" count = 0 while count < 3: name = input("用户名:") password = input("密码:") if name == user_name and password == user_password: print("登录成功") break else: print("登录失败") count +=1
原文地址:https://www.cnblogs.com/riling/p/10068779.html
时间: 2024-11-06 18:31:06