Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # program that takes input from the user and only prints out words with lowercase vowels
- # digits or borth but not words with uppercase letters
- import re
- from collections import Counter
- userInput = raw_input("Please enter a sentence: ")
- list = []
- for w in userInput.split():
- if re.search(r"[aeiou0123456789]", w):
- if re.search(r"^[^A-Z]", w):
- list.append(w)
- list.sort()
- print "We will now print the list in Alphabetical order"
- print
- print list
- print
- print "We will now print the list in descending order of frequency"
- print
- words = Counter(list)
- print words
Advertisement
Add Comment
Please, Sign In to add comment