I am trying to write a function eliminate that takes a string and 2 optional arguments. The first optional argument (bad_characters) takes a letter and the third argument (case_sensitive) takes a Boolean value. The function should take a string s and remove all instances of bad_characters. If case_sensitive is true, then the function should act case sensitive. If false, then it does not need to. This is what I have so far.
def eliminate(s,bad_characters = [],case_sensitive = True or False):
''' Takes a string s and returns the string with all bad_characters
removed. If case_sensitive is True, then the function will only
remove uppercase letters if there are uppercase letters in
bad_characters.
String --> String'''
while True:
if case_sensitive = False:
for character in s:
if bad_characters == character:
newlist = s.replace(bad_characters,'')
return newlist
break
I am having a hard time figuring out how to make the function remove upper case letters if needed. The function should also work if bad_characters is a list, tuple, or string.