Skip to content
Advertisement

Why .join() didn’t work properly? (Python)

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?

JavaScript

Advertisement

Answer

Try correcting your indentation:

JavaScript

You could also consider utilizing a comprehension:

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement