lundi 15 mars 2021

While loop using strings and if statements

Prompt for python program: 5.16 LAB: Password modifier 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 "!" 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. My code so far:

word = input()
password = ''
i = 0
while i < len(word):

I'm really just confused about changing certain characters in a string using a while loop. I was also trying to use if statements. While loops are hard for me understand. I don't know where to start.

Aucun commentaire:

Enregistrer un commentaire