03.04 · Loops / Practice · 8 min
Stop after finding the first vowel
The search found e, but it kept looking. Its final no-match message is now misleading.
Activity 4 of 8 in Loops
Python 2: Logic, Loops & Functions / 03.04
Practice a for else search
Not started
Repair a search that finds a vowel but keeps scanning and prints a no-vowels message.
Your lesson progress
Empty: not started. Yellow: in progress. Green: complete. Marking the whole activity complete does not replace your test results. These circles save in this browser for this pilot.

Your task: stop the successful search
Keep word assigned to team and vowels assigned to aeiou. Keep the existing found message and no-vowels message. Add the loop control needed to stop immediately after the first vowel is found.
For team, print Found a vowel! exactly once, stop with char holding e, and skip the loop else. Keep else aligned with for. Do not delete the no-vowels path; it is needed when no character matches.
Try the no-match and empty-word paths too
The fixed-input checks inspect the word, vowel characters, last visited character and complete output. They do not prove every other word or the algorithm used. After passing, try rhythm: expect No vowels found in the word. Try an empty word: expect the same no-vowels message without visiting a character.
Restore team before checking again. This beginner rule checks the lowercase vowels listed in vowels; uppercase letters are outside this task’s rule.
Build it one step at a time
Prefer learning by typing? Work through short instructions, run the Python code and check each change before continuing. Your guided project saves separately from the challenge below.
The mini-lesson opens in a new tab. Your own code carries forward; each step has a focused check and an optional hint.
Start mini-lesson(opens in a new tab)3 steps · Saved work · Instant feedback
YOUR TURN
Stop at the first matching vowel
Keep word = "team" and vowels = "aeiou". Stop the search immediately after printing the first found message. Preserve the loop else for words with no matching lowercase vowel.
Found a vowel!
Keep the starting inputs. Print these lines in this order, without extra output.
- Keep word as team
- Keep the lowercase vowel set
- Stop with char at the first vowel e
Edit Python, then run it. Check challenge checks your output and the listed Python requirements. Your code saves on this browser after a short pause. Sign in and choose Save account draft to keep it across devices. Word wrap is enabled.
Ready to checkRun the checks to see your results here.
Your check results
Need a nudge?
Finding a match should exit the search
break exits the loop and skips its else. Put it in the same if block as the found message, after that print.
One possible solution
Your code may look different and still be correct. Compare the approach with your own.
break stops on e and skips both the later vowel a and the no-match else. A word such as rhythm exhausts normally and reaches else.
word = "team"
vowels = "aeiou"
for char in word:
if char in vowels:
print("Found a vowel!")
break
else:
print("No vowels found in the word.")Ready to try it?
Practice in your browser and see your results.
Progress details
Have a question?
Ask the Code Zone community.
Ask a question in The Code Zone (opens in a new tab)Continue learning

7 days freeTry The Code Zone
THE CODE ZONE COMMUNITY
Your next step is easier together.
Try the community free for 7 days.
No charge during your trial. Choose your plan on Skool.
- Ask questions and get support in the community
- Watch every course video walkthrough
- Find a study buddy in the 24/7 study room
Make the most of your trial with Premium.
Choose Premium on Skool to try Thursday live help sessions. Bring your questions, work through code, and get unstuck together.
Scheduled Thursdays in Eastern Time. Check the Skool calendar for your local date and time.
Have a website account? Sign in