Many user-created passwords are simple and easy to guess. Write a program that takes a simple password and makes it stronger b replacing characters using the key below, and by appending "!" to the end of the input string. . i becomes 1 a becomes @ . m becomes M . B becomes 8 s becomes $ Ex: If the input is: mypassword the output is: Myp@$$word! Hint: Python strings are immutable, but support string concatenation. Store and build the stronger password in the given password variable.
Algorithm:
Step 1: Start
Step 2: Initialize an empty string called 'password'
Step 3: Loop through each character in the given word
Step 4: Check if the character is 'i' and if yes, replace it with '1' and add to 'password'
Step 5: Check if the character is 'a, and if yes, replace it with '@' and add to 'password'
Step 6: Check if the character is 'm' and if yes, replace it with 'M' and add to 'password'
Step 7: Check if the character is 'B', and if yes, replace it with '8' and add to 'password'
Step 8: Check if the character is 's', and if yes, replace it with '$' and add to 'password'
Step 9: If the character is not any of the above, add the character to 'password' as it is
Step 10: Add an exclamation mark to the end of the 'password'
Step 11: Print the generated password
Step 12: End
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images