From d52743da872781ff017150346cacf01ab016898b Mon Sep 17 00:00:00 2001 From: gputnam Date: Wed, 6 Nov 2013 19:38:39 -0500 Subject: [PATCH 1/3] finished hello world example --- exercises-hello/hello.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises-hello/hello.py b/exercises-hello/hello.py index 142f68d..7276cea 100644 --- a/exercises-hello/hello.py +++ b/exercises-hello/hello.py @@ -7,5 +7,5 @@ # # Run ./test.sh to make sure your program matches our expected output. # -# TODO: write your code below +print "Hello World" From 70eb61794857106d7f59f9eeb78c8bd4b7665e3d Mon Sep 17 00:00:00 2001 From: gputnam Date: Wed, 6 Nov 2013 19:40:19 -0500 Subject: [PATCH 2/3] created python script --- exercises-hello/script.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 exercises-hello/script.py diff --git a/exercises-hello/script.py b/exercises-hello/script.py new file mode 100755 index 0000000..b5c2d1c --- /dev/null +++ b/exercises-hello/script.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python +print "this is a python script!" + From fd6e81779b9d8dd33c36fe63d81dc9281b4790e4 Mon Sep 17 00:00:00 2001 From: gputnam Date: Wed, 6 Nov 2013 20:08:35 -0500 Subject: [PATCH 3/3] finished spell checker --- exercises-spellchecker/dictionary.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/exercises-spellchecker/dictionary.py b/exercises-spellchecker/dictionary.py index e71878a..54dbf34 100644 --- a/exercises-spellchecker/dictionary.py +++ b/exercises-spellchecker/dictionary.py @@ -16,22 +16,29 @@ def load(dictionary_name): Each line in the file contains exactly one word. """ # TODO: remove the pass line and write your own code - pass + dic = open(dictionary_name, "r") + words = set() + for line in dic: + line_stripped = line.strip() + words.add(line_stripped) + dic.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() + return True