From 5f504165ca115b15d6ae5c39cf3aa88b874660c4 Mon Sep 17 00:00:00 2001 From: Nubco <77243923+cabbott008@users.noreply.github.com> Date: Sat, 6 May 2023 07:20:16 +0000 Subject: [PATCH] merge past --- .codesandbox/Dockerfile | 1 + .codesandbox/tasks.json | 13 +++++++++++++ ex10.3.py | 14 +++++++------- main.py | 0 requirements.txt | 0 5 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 .codesandbox/Dockerfile create mode 100644 .codesandbox/tasks.json create mode 100644 main.py create mode 100644 requirements.txt 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