finished lab 1

This commit is contained in:
Benjamin committed 2026-01-29 16:16:12 -05:00
1 parent 9af5ad39e4
commit 502962eb5e
8 files changed
+8 -1

No files matched your search

Vendored
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 486 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 KiB

+8 -1
View File
@@ -19,10 +19,17 @@ def countWords(filename: str) -> dict[str, int]:
def main() -> None:
filename = "words.txt"
filename = "data/words.txt"
counts = countWords(filename)
print(counts)
if __name__ == "__main__":
main()
"""
1. Copying a file created 2 identical coppies so the funciton can still read the data.
2. cp is safer because it leave the original file untouched.
3. If the data folder is deleted, the program will not be able to find the file and will raise a FileNotFoundError.
4. The dictionary keys represent words, which are strings. If they were stored as integers, boolens, floats, etc, it would create errors.
"""
File renamed without changes.