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 trialekjot singh
1,542 Pointswhy my code is not running? please help!!
i don't know why this is not running
def disemvowel(word):
for i in word:
if i.lower() in ['a','e','i','o','u']:
word.remove(i)
elif i.upper() in ['A','E','I','O','U']:
word.remove(i)
return word
1 Answer
Gustavo Winter
Courses Plus Student 27,382 Pointsdef disemvowel(word):
final_word = ''
vogals = ['a', 'e', 'i', 'o', 'u']
for letter in word:
if letter.lower() not in vogals:
final_word += letter
return final_word
1 -This work for me.
2 - First you set a empty variable "final_word".
3 - Then you set the vogals.
4 - Check if the letter has the declared "vogals".
5 - add the remaining letter for our empty variable.
6 - and to finish the challange return the variable "final_word".
I hope i have helped.
ekjot singh
1,542 Pointsthank you Gustavo winter
Ari Misha
19,323 PointsAri Misha
19,323 PointsHiya Ekjot! This can be done in few lines and without using lowercases and uppercases. Here is the code(insteading of copying it try to get the logic behind it):