你如何使用一会儿陈述来问一个问题直到事情发生

时间:2018-11-20 02:01:35

标签: python if-statement while-loop

print('please answer a few questions to create an account')
usersetup = input('what would you like your username to be ')
for index in range(dl):
    while accounts[index][0] == usersetup:
        usersetup = ('username taken. Please try again')
    if accounts[index][0] == usersetup:
        break   
    psetup = input('What would you like your password to be ')
    accounts.append([usersetup,psetup])
#Setting up account for new users.
    outputFile = 'accounts.data'
    fw = open(outputFile, 'wb')
    pickle.dump(accounts, fw)
    fw.close()
#Storing data by using pickle.
    print('Thank you for signing up, please log in.')

当我运行此程序时,它会跳过while块,并继续解决该问题?

0 个答案:

没有答案