In: Computer Science
It’s not easy
to come up with a secure password that one can actually remember.
One of the
methods proposed is to take a line of text and take first letter of
each word to form
a password. An extra step is substitute ”o” with 0, ”a” with ”@”,
and ”l” with
1. For instance, using ”Come to the meadow on law street” would
yield
”Cttm01s”. Write a program that asks the user to enter a phrase and
outputs
the password that is generated using these rules.
You can assume that the words in the phrase will be separated by a
single space or
a common punctuation sign such as ”.,?!;:” followed by a space.
PYTHON PLEASE! THANK YOU
#source code:
password=input("Enter the password:")
list=password.split(" ")
password_text=""
new_password=""
for i in range(len(list)):
for j in range(len(list[i])):
if(j==0):
if(list[i][j]=="o"):
password_text+=str(0)
new_password+=str(0)
elif(list[i][j]=="a"):
password_text+="@"
new_password+="@"
elif(list[i][j]=="l"):
password_text+=str(1)
new_password+=str(1)
elif(list[i][j]!="o" or "a" or "l"):
password_text+=list[i][j]
new_password+=list[i][j]
else:
new_password+=list[i][j]
new_password+=" "
print(password_text)
print(new_password)
#output:
#if you have any doubts comment below...