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

I have no idea how to solve this problem, can someone help me?

I get the concept of the question, I just don't know how to formulate it in code. An explicit explanation would be helpful.

disemvowel.py
def disemvowel(word):
    return word

1 Answer

Alex Koumparos
seal-mask
.a{fill-rule:evenodd;}techdegree
Alex Koumparos
Python Development Techdegree Student 36,887 Points

Hi Alestaire,

Here's one approach, using only simple concepts.

  1. Make a constant that is a list of vowels (you will later test whether letters are in this list);
  2. Create a variable initialised as an empty string, this is what you are going to build up into the vowelless word;
  3. Use a for loop to iterate through your input word;
  4. Inside your for loop check if the character is in your list of vowels;
  5. a. If it is in your list, continue to the next iteration of the loop;
    b. If it isn't in your list, add it to the string you created at the beginning of the function;
  6. After the loop finishes, return the string you created.

Hope that's clear

Cheers

Alex