I'm trying to write a function that uses a checker that could be any length and checks it against the list. It should be case insensitive when checking and print the word. Example below
Input= startsWith('a',['apple','ApPle','orange','Apple','kiwi','apricot'])
Output:
apple
ApPle
Apple
apricot
But, it prints every string in the list all in lower case.
def startsWith(checker,lister):
checker.lower()
size = len(lister)
i=0
checklength = len(checker)
lister = [element.lower() for element in lister]
while(i<size):
checkinlist = lister[i]
if(checkinlist[0:checklength-1] in checker):
# this is just to test to see if the variables are what i need
# once the if statement works just append them to a new list
# and print that
print(lister[i])
i=i+1