Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Java laugh simple

Name: Anonymous 2013-02-16 10:42

My head is spinning at the fact I cant do such a simple problem, a month off really didnt do me any good.

How do I check if a string which contains a phrase or a word has all its vowels but in alphabetical order.
eg. aerious

Name: Anonymous 2013-02-16 10:59

[code]
s = "aerious"
vowels = ('a','e','i','o','u')
valid = True

i = 0
for c in s:
    if c in vowels:
        if i > len(vowels)-1:
            valid = False
            break
        if vowels[i] == c:
            i+=1
            continue
        else:
            valid = False
            break

if i < len(vowels): valid = False

print "Valid" if valid else "Invalid"
[code]

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List