Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> # Write a program that reads words.txt and prints only the words with
- # more than 20 characters (not counting whitespace).
- # Current Status: Complete
- with open('words.txt', 'r') as fd:
- wordList = fd.read().split()
- print [word for word in wordList if len(word) > 20]
- ##################################################################################
- #my first solution
- fin = open('words.txt')
- t = fin.read().split('\n')
- for i in range(0,len(t)):
- if len(t[i])>5 and len(t[i])<10 :
- print t[i]
- fin.close()
- ['counterdemonstrations', 'hyperaggressivenesses', 'microminiaturizations']
- aahing
- aaliis
- aardvark
- aardvarks
- aardwolf
- aasvogel
- aasvogels
- abacas
- abacus
- abacuses
- abakas
- abalone
- abalones
- abampere
- abamperes
- abamps
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement