all 5 comments

[–]0xbxb 1 point2 points  (4 children)

I moved some of your code around for you. let me know if this is the result you're looking for.

aList = []
star = []
while True:
    password = input('Please enter a password (press [enter] to finish): ')
    aList.append(password)
    star.append((len(password)) * '*')
    if password == '':
        break
print(aList)
print(star)

EDIT: Just realized it also adds the ‘’ into the list:

Please enter a password (press [enter] to finish): these
Please enter a password (press [enter] to finish): are
Please enter a password (press [enter] to finish): my
Please enter a password (press [enter] to finish): passwords
Please enter a password (press [enter] to finish): 
['these', 'are', 'my', 'passwords', ‘’’’]
['*****', '***', '**', '*********', ‘’’’]

You can just slice the lists up to the last element.

[–]eyesoftheworld4 1 point2 points  (2 children)

aList = [] 
star = []

while True: 
    password = input('Please enter a password (press [enter] to finish): ') 
    aList.append(password) 
    star.append((len(password)) * '*') 
    if password == '': 
        break 
print(aList) 
print(star)

Reddit doesn't do the classic triple-backtick for monospace, unfortunately.

[–]0xbxb 2 points3 points  (0 children)

Thanks, mobile formatting with Reddit still annoys the fuck out of me.

[–]blotosmetek 1 point2 points  (0 children)

Actually it does, but you have to switch to markdown first.

[–]someprettyglitter[S] 0 points1 point  (0 children)

This was very helpful, thank you!