I need to right a function called nodups(text) that takes a string of characters
ID: 3630383 • Letter: I
Question
I need to right a function called nodups(text) that takes a string of characters and removes the same string with any duplicated character only appearing once -- removing any duplicated copy of a character.The answer needs to be a list comprehension with no forward loops
it should look like for example
def nodups(text):
return [ i for i in text if "conditional statement"]
and the conditional statement needs to use splicing/slicing[#:#]
Examples: nodups("Iowa") is 'Iowa' (no dupliates)
nodups("eventually") is 'evntualy'
Explanation / Answer
Example usage:
Example usage: