這是什麼造成了無限循環?如果它沒有創建一個,爲什麼程序凍結?不像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