Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions exercises-hello/hello.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
#
# TODO: write your code below

print "hello world"
2 changes: 2 additions & 0 deletions exercises-hello/script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env python
print "this is a python script!"
15 changes: 10 additions & 5 deletions exercises-spellchecker/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,28 @@ def load(dictionary_name):

Each line in the file contains exactly one word.
"""
# TODO: remove the pass line and write your own code
pass
words = set()
words_file = open(dictionary_name, "rb")
for word in words_file:
word = word.strip()
words.add(word)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can combine these two lines.
words.add(word.strip())

words_file.close()
return words

def check(dictionary, word):
"""
Returns True if `word` is in the English `dictionary`.
"""
pass
return word in dictionary

def size(dictionary):
"""
Returns the number of words in the English `dictionary`.
"""
pass
return len(dictionary)

def unload(dictionary):
"""
Removes everything from the English `dictionary`.
"""
pass
dictionary.clear()