这是什么造成了无限循环?如果它没有创建一个,为什么程序冻结?不像IDLE停止响应,它只是停止,就像我创建了一个无限循环,它唯一做的就是input()。试着看看我的意思。 (也告诉我,如果在评论中为的是正确的,请)为什么这个函数创建一个无限循环?
Accounts = {}
def create_account(x,y,z,a):
global Accounts
Checked = False
while Checked == False:
if x in Accounts:
print("Sorry, that name has already been taken")
print("Please choose a new name")
x = input()
for dictionary in Accounts:
for key in dictionary:
if a in key:
print("Sorry, password is invalid or not avalible")
print("Please choose a new password")
a = input()
Accounts[x] = {"Proggress":y,"Points":z,"Pass":a}
print(Accounts[x])
在哪里'检查'成为'真'来打破循环?无处。在哪里可以打破它呢?无处。没有回报,没有任何东西,你会得到一个无限循环。 –
为了退出while循环,你必须设置检查为真 – mWhitley
为什么不'def create_account(name,progress,points,password)'? 'x,y,z,a'是非常不清楚的。 – IanAuld