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 trialSaloni Gandhi
1,531 Pointsdevowel.py .. i am getting a logical error- a weird output
state_names=['Newyork','Massachusetts','California'] output=[] vowels=list('aeiou')
for something in state_names: new_statelist=list(something.lower())
for thing in vowels:
while True:
try:
state_names.remove(thing)
except:
break
output.append(''.join(new_statelist).capitalize())
print output print new_statelist
//logical error - weird output someone plz help me out
1 Answer
Gavin Ralston
28,770 PointsIn your try block, you're removing thing (the vowel) from the state_names list rather than the new_statelist you created to hold the list of characters.
As an aside, try using more meaningful variable names than "thing" in your for loops. "vowel in vowels" would have made it easier to spot that you were trying to remove a vowel from a list of state names, I think. Also "weird output" is not as helpful as posting the output. :)
Good luck!