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 trialvsiddharthverma
3,182 PointsAbout For...loop
state_names = ["Alabama","California","Oklahoma","Florida]
vowels = list('aeiou') # vowels will return ["a","e","i","o","u"]
output = []
for state in state_names:
state_list = list(state.lower()) #what value sate_list will return
for vowel in vowels: # for vowel
while True:
try:
state_list.remove(vowel)
except:
break
output.append('',join(state_list).capitalize())
print(output)
There are two for-loops, what is the sequence of doing the loop?
1 Answer
vsiddharthverma
3,182 PointsI meant for..loop. The order is to finish the first loop to iterate every item in state_list until its done and go to the second for..loop or read one item in state_list and going to the second for..loop?
James Gill
Courses Plus Student 34,936 PointsJames Gill
Courses Plus Student 34,936 PointsXi,
I edited your question to make the code more legible, but made no changes. I'm sorry, I don't understand your question. Can you explain more?