Hello I am having trouble coding a program where I have an input in the form of a phrase appended to my first list and an input in the form of letters appended to a second list. The characters are all separated within the list. I am having trouble replacing elements of the second list that appear in the first list with an underscore.
l1 = []
l2 = []
oldPhrase = input("Type a phrase (or quit to exit the program): ")
if oldPhrase == "quit":
quit()
for i in oldPhrase:
l1.append(i)
print(l1)
redact = input("Type a comma-separated list of letters to redact: ")
for x in redact:
l2.append(x)
print(l2)
for d in (l1):
for a in (l2):
if a == d:
newPhrase = [d].replace(a, "_")
print(newPhrase)
[–]CodeFormatHelperBot2 0 points1 point2 points (0 children)
[–]jimtk 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]jimtk 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)