I'm currently in a Python Scripting course and I'm struggling with a lab. This is the prompt: Many user-created passwords are simple and easy to guess. Write a program that takes a simple password and makes it stronger by replacing characters using the key below, and by appending "q*s" to the end of the input string.
i becomes. a becomes @ m becomes MB becomes 8 o becomes .
Ex: If the input is: mypassword the output is: Myp@ssw.rdq*s
My Issue: I can't figure out how to add the "qs" at the end of the new password so instead of it being p@ssw.rdq*s, my code is running p@ssw.rd
I've managed to get this :
word = input()
password = ''
for character in word:
if(character=='i'):
password += '!'
elif(character=='a'):
password += '@'
elif(character=='m'):
password += 'M'
elif(character=='B'):
password += '8'
elif(character=='o'):
password += '.'
else:
password += character
print(password)
Just before you print the password, add password += 'q*s'
, outside of the for loop.
This will add the q*s
after all other characters have been processed.
after your for-loop, you can add:
password += 'q*s'
Try and add: password+='q*s'.After your for loop
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.