diff --git a/.codesandbox/Dockerfile b/.codesandbox/Dockerfile new file mode 100644 index 0000000..9e15170 --- /dev/null +++ b/.codesandbox/Dockerfile @@ -0,0 +1 @@ +FROM python:3.11.3 diff --git a/.codesandbox/tasks.json b/.codesandbox/tasks.json new file mode 100644 index 0000000..bfd023c --- /dev/null +++ b/.codesandbox/tasks.json @@ -0,0 +1,13 @@ +{ + // These tasks will run in order when initializing your CodeSandbox project. + "setupTasks": ["pip install -r requirements.txt"], + + // These tasks can be run from CodeSandbox. Running one will open a log in the app. + "tasks": { + "start": { + "name": "start", + "command": "python main.py", + "runAtStart": true + } + } +} diff --git a/ex10.3.py b/ex10.3.py index 072920b..463f634 100644 --- a/ex10.3.py +++ b/ex10.3.py @@ -1,8 +1,8 @@ -import string -# fnand = input('Enter file: ') + +fnand = input('Enter file:') try: - lines = open('mbox-short.txt') + lines = open(fnand) except: print('File cannot be opened') exit() @@ -10,13 +10,13 @@ counts = dict() for line in lines: - # line = line.rsplit() line = line.split() + # line = line.rstrip() + # line = line.translate(line.maketrans(' ', ' ', string.punctuation)) + # line = line.lower() for word in line: - word = word.split() - word =word.translate(word.maketrans('', '', string.punctuation)) + word = line.split() for ch in word: - ch = ch.lower() if ch not in counts: counts[ch] = 1 else: diff --git a/main.py b/main.py new file mode 100644 index 0000000..e69de29 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e69de29