How do I get my (if "input" in list) to check every letter of the input and not just the first letter of input?
This is my code now:
alphabet = "abcdefghijklmnopqrstuvwxyzæø˚a ?"
my_list=list(alphabet)
n= input()
def textis():
for word in n.split():
if word in my_list:
print(word)
else:
x=word.replace(n,"?")
print (x)
textis()
but it only checks the first letter of the input. I want it to check every letter of input and change the ones that dont are in list to "?", and print the input again with the changes "?" in the sentence. So if input is, hello My name Is, output should be hello ?y name ?s.
Here are the problems:
What I did was make a new variable and made changes to that variable and then returned this variable.
alphabet = "abcdefghijklmnopqrstuvwxyzæø˚a ?"
my_list = list(alphabet)
n = input()
def textis(n, my_list):
new = ''
for letter in n:
if letter in my_list:
new += letter
else:
new += "?"
return new
print(textis(n, my_list))
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments