-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvowel_eater_pretty.py
More file actions
27 lines (22 loc) · 1.12 KB
/
Copy pathvowel_eater_pretty.py
File metadata and controls
27 lines (22 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""
Your task here is even more special than before: you must redesign the (ugly) vowel eater from the previous lab and create a better, upgraded (pretty) vowel eater! Write a program that uses:
a for loop;
the concept of conditional execution (if-elif-else)
the continue statement.
Your program must:
ask the user to enter a word;
use user_word = user_word.upper() to convert the word entered by the user to upper case;
use conditional execution and the continue statement to "eat" the following vowels A, E, I, O, U from the inputted word;
assign the uneaten letters to the word_without_vowels variable and print the variable to the screen.
word_without_vowels and assigned an empty string to it. Use concatenation operation to ask Python to combine selected letters into a longer string during subsequent loop turns, and assign it to the word_without_vowels variable.
"""
word_without_vowels = ""
user_word = input("Input a word: ")
user_word = user_word.upper()
vowels = ["A", "E", "I", "O", "U"]
for letter in user_word:
if letter in vowels:
continue
else:
word_without_vowels += letter
print(word_without_vowels)