finished lab 1

This commit is contained in:
2026-01-29 16:16:12 -05:00
parent 9af5ad39e4
commit 502962eb5e
8 changed files with 8 additions and 1 deletions

BIN
.DS_Store vendored

Binary file not shown.

BIN
Lab 1/.DS_Store vendored

Binary file not shown.

BIN
Lab 1/Screenshot 3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 KiB

BIN
Lab 1/Screenshot 4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 KiB

BIN
Lab 1/Screenshot 5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 KiB

BIN
Lab 1/Screenshot 6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 KiB

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.
"""