From d15c4f2b65907ab390512e2148018960def0e5ea Mon Sep 17 00:00:00 2001 From: Amanpreet Kandola Date: Wed, 6 Nov 2013 19:42:33 -0500 Subject: [PATCH 1/4] stuff --- hello.py | 1 + script.py | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 hello.py create mode 100755 script.py diff --git a/hello.py b/hello.py new file mode 100644 index 0000000..8cde782 --- /dev/null +++ b/hello.py @@ -0,0 +1 @@ +print("hello world") diff --git a/script.py b/script.py new file mode 100755 index 0000000..6a36816 --- /dev/null +++ b/script.py @@ -0,0 +1,2 @@ +#!/usr/bin/env python +print ("this is a python script!") From 283c001ebfc246500dcd6c1f49a4a22ff37155c7 Mon Sep 17 00:00:00 2001 From: Amanpreet Kandola Date: Wed, 6 Nov 2013 19:43:44 -0500 Subject: [PATCH 2/4] removed --- hello.py | 1 - script.py | 2 -- 2 files changed, 3 deletions(-) delete mode 100644 hello.py delete mode 100755 script.py diff --git a/hello.py b/hello.py deleted file mode 100644 index 8cde782..0000000 --- a/hello.py +++ /dev/null @@ -1 +0,0 @@ -print("hello world") diff --git a/script.py b/script.py deleted file mode 100755 index 6a36816..0000000 --- a/script.py +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env python -print ("this is a python script!") From 5fb4f61b1a9511e0b40f548ad9b48f8c52749a5d Mon Sep 17 00:00:00 2001 From: Amanpreet Kandola Date: Wed, 6 Nov 2013 19:50:59 -0500 Subject: [PATCH 3/4] first two --- hello.py | 1 + script.py | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 hello.py create mode 100644 script.py diff --git a/hello.py b/hello.py new file mode 100644 index 0000000..8cde782 --- /dev/null +++ b/hello.py @@ -0,0 +1 @@ +print("hello world") diff --git a/script.py b/script.py new file mode 100644 index 0000000..6a36816 --- /dev/null +++ b/script.py @@ -0,0 +1,2 @@ +#!/usr/bin/env python +print ("this is a python script!") From de325b22335f01198ae50d96aeb54c576aa336d7 Mon Sep 17 00:00:00 2001 From: Amanpreet Kandola Date: Wed, 6 Nov 2013 20:06:06 -0500 Subject: [PATCH 4/4] dictionary --- exercises-spellchecker/dictionary.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/exercises-spellchecker/dictionary.py b/exercises-spellchecker/dictionary.py index e71878a..9a2995d 100644 --- a/exercises-spellchecker/dictionary.py +++ b/exercises-spellchecker/dictionary.py @@ -4,7 +4,6 @@ with a python dictionary here--anytime you see the word "dictionary", we mean English dictionary). """ - def load(dictionary_name): """ Opens the file called `dictionary_name` and returns @@ -15,23 +14,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 + f = open(dictionary_name) + lines = f.readlines() + words = set() + for x in lines: + stripped = x.strip + words.add(stripped) + f.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