Reputation: 167
Hello everyone I've been practicing with python for a bit now and found a project named Ubbi. Pretty much the whole goal is, is to add a string 'ub' before every vowel. So my question am i even close to cracking this or should i head another route??
def ubbidubbi_word(eword):
ubword = ""
for i in eword:
if i == 'aeoiuy': ubword += 'ub'+eword(i)
else: ubword += eword(i)
return ubword
Upvotes: 0
Views: 59
Reputation: 881805
You're close! However...:
(A) eword(i)
would call eword
as a function with argument i
, which makes no sense; just use i
itself, the character you're currently looking at (maybe you're thinking of Javascript here...? but even there the syntax will be different);
(B) i
, a single character, will never equal the string 'aeoiuy'
, as you're checking; rather you should check if i
is in that string (and thus a vowel).
Upvotes: 1