Created
January 9, 2018 00:00
-
-
Save RikerW/adfdbba2c2110b96fadccd2668595f34 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n=raw_input() | |
1/n.isalpha() | |
x=sum([1if i in'aeiou'else 0for i in list(n.lower())]) | |
print'Vowels: '+`x`,'Consonants'+`len(n)-x` | |
# line breakdown: | |
n=raw_input() # get input, assign to n | |
1/n.isalpha() # make sure n is only letters, since 1/false evaluates to 1/0 which is an error | |
x=sum([1if i in'aeiou'else 0for i in list(n.lower())]) # count vowels, and yes "1if" and "0for" are valid syntax | |
print'Vowels: '+`x`,'Consonants'+`len(n)-x` # print output, formatted nicely, `x` is shorthand for repr(x) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment