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 trialChris Sederqvist
7,596 Points[SOLVED] Not accepted by Treehouse, works fine in my environment.
Here is my code, that works fine in my environment but Treehouse refuses to accept it:
def disemvowel(word):
vowels = ('a', 'e', 'i', 'o', 'u')
temp = []
for l in word.lower():
if l not in vowels:
temp.append(l)
return ''.join(temp)
When I try with:
w = 'AIlaptopuiaEXOdus'
print(disemvowel(w))
it returns:
lptpxds
4 Answers
Frank Campos
4,175 Pointsthe problem is that you have to return word, no temp. I hope this help
def disemvowel(word):
vowels = ('a', 'e', 'i', 'o', 'u')
temp= word
word = []
for l in temp.lower():
if l not in vowels:
word.append(l)
else:
pass
print( ''.join(word))
disemvowel('AIlaptopuiaEXOdus')
Chris Sederqvist
7,596 PointsYour code does not work either. Point is that my code returns the correct values, shouldn't be necessary to rename the variable returned...
Tim Sullivan
1,916 PointsI think the problem lies in the fact that you are changing the case of the input in your function.
Treehouse expects that an input of "HELLO" will return "HLL"
Your function as written takes "HELLO" and returns "hll"
Chris Sederqvist
7,596 PointsWell, the assignment was to make sure both upper and lowercase are handled. But... I probably misunderstood something in the text.
I move on with life after solving it like this:
def disemvowel(word):
vowels = ('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U')
temp = []
for l in word.lower():
if l not in vowels:
temp.append(l)
return ''.join(temp)
Thanks for your feedback.
Chris Sederqvist
7,596 PointsI managed to figure out a way to solve it. See below.
Frank Campos
4,175 PointsChris Sederqvist it is odd, your code works perfectly in Pycharm. I tried differents ways and neither of them passed. Maybe, it is a bug.
Chris Sederqvist
7,596 PointsAfter adding 'A', 'E', 'I', 'O', 'U' to the tuple of vowels it passes in Treehouse as well.
Frank Campos
4,175 PointsChris Sederqvist I saw the change you did to your code. I pasted it in the challenge, but it didn't pass either. Very weird!!!!
Chris Sederqvist
7,596 PointsWorked for me! :)
Frank Campos
4,175 PointsFrank Campos
4,175 Pointsthe probles is that you have to return word, no temp. I hope this help