Print Without Vowels
Beginner · Write the code · from Python break, continue, pass: Controlling Loop Flow
From the lesson: Python break, continue, pass: Controlling Loop Flow
You're searching through a phone book for your friend's number. Once you find it, do you keep flipping through every remaining page? Of course not - you stop. Or imagine you're reading a list of emails. You skip the spam and only read the real ones. These are everyday examples of controlling the flow of a loop.
Read the lessonUse a for loop with continue to print all the characters in the string "beautiful", but skip the vowels (a, e, i, o, u). Print each consonant on the same line using end="".
Expected output:
btflDon't forget to print an empty print() at the end for a clean newline.
word = "beautiful"
# Print each character, but skip vowels using continue
print() # newline at the end
More break, continue, pass exercises
- Find the First Negative NumberBeginner
- Predict the OutputBeginner
- Fix the Bug: Sum Until NegativeBeginner
- Password Checker with for-elseBeginner
All Python exercises · 50 practice problems · Control Flow quiz