From e457922cd42e777be5be61cfbdd3d15aababedbb Mon Sep 17 00:00:00 2001 From: sascha Date: Thu, 7 Mar 2024 09:34:02 +0000 Subject: [PATCH] dictionary --- dictionary.py | 23 +++++++++++++++++++++++ hello.py | 4 +++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 dictionary.py diff --git a/dictionary.py b/dictionary.py new file mode 100644 index 0000000..568653b --- /dev/null +++ b/dictionary.py @@ -0,0 +1,23 @@ +from fileinput import close + +words = set() + +def check(word): + if word.lower() in words: + return True + else: + return False + +def load(dictionary): + file = open(dictionary, "r") + for line in file: + word = line.rstrip() + words.add(word) + close(file) + return True + +def size(): + return len(words) + +def unload(): + return True \ No newline at end of file diff --git a/hello.py b/hello.py index b536a14..4aa6b97 100644 --- a/hello.py +++ b/hello.py @@ -1,2 +1,4 @@ -answer = input("What's your name? ") +from cs50 import get_string + +answer = get_string("What's your name? ") print(f"Hello {answer}!") \ No newline at end of file