From 2803cc85edb6f7c3dd6be3be9e1ef6ee78d2b75d Mon Sep 17 00:00:00 2001 From: Ife Fahm Date: Fri, 28 Oct 2016 02:46:13 -0400 Subject: [PATCH 1/3] finished hello world example --- exercises-hello/hello.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises-hello/hello.py b/exercises-hello/hello.py index 142f68d..cd3674d 100644 --- a/exercises-hello/hello.py +++ b/exercises-hello/hello.py @@ -2,10 +2,10 @@ # # This is your first python program! # print out "hello world" to the terminal. -# # When you are done, run the program with: python hello.py # # Run ./test.sh to make sure your program matches our expected output. # # TODO: write your code below - +print("hello world") +# From cdb077cf318a69541b0eed4c5c1fbba5c5beb6f0 Mon Sep 17 00:00:00 2001 From: Ife Fahm Date: Fri, 28 Oct 2016 02:46:39 -0400 Subject: [PATCH 2/3] created python script --- exercises-hello/script.py | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 exercises-hello/script.py diff --git a/exercises-hello/script.py b/exercises-hello/script.py new file mode 100644 index 0000000..1b9f121 --- /dev/null +++ b/exercises-hello/script.py @@ -0,0 +1,2 @@ +#!/usr/bin/env python +print "this is a python script!" \ No newline at end of file From 763888d30ab9a1262c999552e4f67bfa6880bda4 Mon Sep 17 00:00:00 2001 From: Ife Fahm Date: Fri, 28 Oct 2016 05:39:44 -0400 Subject: [PATCH 3/3] finished spell checker boi --- exercises-spellchecker/dictionary.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/exercises-spellchecker/dictionary.py b/exercises-spellchecker/dictionary.py index e71878a..df8e2ea 100644 --- a/exercises-spellchecker/dictionary.py +++ b/exercises-spellchecker/dictionary.py @@ -5,6 +5,7 @@ "dictionary", we mean English dictionary). """ + def load(dictionary_name): """ Opens the file called `dictionary_name` and returns @@ -15,23 +16,35 @@ def load(dictionary_name): Each line in the file contains exactly one word. """ - # TODO: remove the pass line and write your own code - pass + global counter + counter = 0 + wordlist=[[] for x in range(2000)] + with open(dictionary_name) as words: + for word in words: + stripword = word.strip() + wordhash = hash(stripword) % 2000 + wordlist[wordhash].append(stripword) + counter = counter + 1 + return wordlist + def check(dictionary, word): """ Returns True if `word` is in the English `dictionary`. """ - pass + return (word in dictionary[(hash(word.lower())%2000)]) def size(dictionary): """ Returns the number of words in the English `dictionary`. """ - pass + return counter def unload(dictionary): """ Removes everything from the English `dictionary`. """ - pass + for subdict in dictionary: + for word in subdict: + subdict.remove(word) + dictionary.remove(subdict)