Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Collections (2016, retired 2019) Lists Disemvowel

Immanuel wiessler
Immanuel wiessler
2,726 Points

question on vowelremover I am not sure how to return the final section of this code in a return statement

import time def vowel(word): vowel_letters=["a","A","e","E","i","I","o","O","u","U"] word_letter=[] for letters in word: word_letter.append(letters) for i in range (0,len(vowel_letters)): vowel_cosntant=vowel_letters[i] while vowel_cosntant in word_letter: print('Removing->{}'.format(vowel_cosntant)) word_letter.remove(vowel_cosntant) if vowel_cosntant not in word_letter: print(word_letter) for final_word in word_letter: time.sleep(0.1) print(final_word,end='')

disemvowel.py
def disemvowel(word):
    return word
Alex Koumparos
seal-mask
.a{fill-rule:evenodd;}techdegree
Alex Koumparos
Python Development Techdegree Student 36,887 Points

Hi Immanuel,

Please ensure all your code is properly formatted using Markdown. There is a link to the Markdown Cheatsheet below the text entry box.

Thanks,

Alex

1 Answer

Steven Parker
Steven Parker
229,744 Points

It looks like your "disemvowel" function simply returns the argument it was given unchanged. This is the way the code starts out in the challenge.

The rest of the code (the unformatted part) appears to define a completely separate function named "vowel", which is not part of the instructions. The code for the challenge should all be done inside the "disemvowel" function.

Immanuel wiessler
Immanuel wiessler
2,726 Points

so i should formatted within the function rather then outside,However it would still works with the print statment

Steven Parker
Steven Parker
229,744 Points

The challenge only checks what the disemvowel function return‍s. The other function (named "vowel") will not be tried by the challenge.

You also don't need to "print" anything (and it won't help for passing the challenge).