Skip to content

Instantly share code, notes, and snippets.

@saviour123
Last active February 18, 2016 11:48
Show Gist options
  • Save saviour123/cce1a3af051b1e36dd41 to your computer and use it in GitHub Desktop.
Save saviour123/cce1a3af051b1e36dd41 to your computer and use it in GitHub Desktop.
This python script prints out all words that have no 'e' in them from the word.txt
The words.txt file is located here. Thnaks so much for your help so far.
http://www.greenteapress.com/thinkpython/code/words.txt
def has_no_e():#not working
mList = open('words.txt')
for word in mList:
mList = word.strip()
if 'e' in word:
return
else:
print word
has_no_e()
##this works also
def has_no_e():
mList = open('words.txt')
for word in mList:
item = word.strip()
if 'e' not in item:
print item
has_no_e()
@jeffgodwyll
Copy link

def has_no_e():
    with open('words.txt') as mList:
        a = mList.read().splitlines()
    for word in a:
        if 'e' not in word:
            print word
has_no_e()

@saviour123
Copy link
Author

Thanks, i just try developing a new one. can give me assignment or projects to work on

@saviour123
Copy link
Author

Thanks, God would definitely reward you for your time.

@jeffgodwyll
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment