The code excludes vowels from a string. The code works, and print() does the job, but I need to return the result. I tried .join()
but it didn't work: it returns only the first character in my case, because the return stops the loop. How can I overcome this?
def remove_vowels(document: str) -> str:
vowels = "aeioyu"
document = document.lower()
for chart in document:
if chart not in vowels:
print(''.join(chart), end = '' )
return (''.join(chart))
remove_vowels("document")