From 799a385bdaef095173a167b384ebe7efb9edf319 Mon Sep 17 00:00:00 2001 From: MickeyShahzad Date: Thu, 13 Feb 2025 13:14:24 -0600 Subject: [PATCH 1/2] =?UTF-8?q?Mickey=F0=9F=8D=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pset1/extensions.py | 20 +++++++++++++++++++- pset3/outdated.py | 4 +++- pset5/bank/test_bank.py | 1 + pset5/fuel/test_fuel.py | 1 + pset5/twttr/test_twttr.py | 1 + 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/pset1/extensions.py b/pset1/extensions.py index f56046b..8e2f6cf 100644 --- a/pset1/extensions.py +++ b/pset1/extensions.py @@ -17,4 +17,22 @@ elif filetype == '.zip': print('application/zip') else : - print('application/octet-stream') \ No newline at end of file + print('application/octet-stream') + + + +# this method is more easier and allows a broader list instead of if-else everything. +types = { + "gif": "image/gif", + "jpg": "image/jpeg", + "jpeg": "image/jpeg", + "png": "image/png", + "pdf": "application/pdf", + "txt": "text/plain", + "zip": "application/zip", + "mp4": "video/mp4", + "csv": "text/csv", +} + +s = input("File name: ").strip().lower().split(".")[-1] +print(types.get(s, "application/octet-stream")) diff --git a/pset3/outdated.py b/pset3/outdated.py index 8fb50a1..58ba43a 100644 --- a/pset3/outdated.py +++ b/pset3/outdated.py @@ -38,7 +38,9 @@ break except: pass -elif date_type == 1: + +# error here, fixed it. +if date_type == 1: month_no = str(month.index(date[0])+1) print(date[2].zfill(4), month_no.zfill(2), date[1].zfill(2), sep='-') diff --git a/pset5/bank/test_bank.py b/pset5/bank/test_bank.py index 906f38f..ac40d38 100644 --- a/pset5/bank/test_bank.py +++ b/pset5/bank/test_bank.py @@ -14,6 +14,7 @@ def test_h(): def test_noH(): assert value('whats up, buddy') == 100 assert value('what the he!@') == 100 + assert value('what the eff') == 100 def test_capital(): assert value('HELLO') == 0 diff --git a/pset5/fuel/test_fuel.py b/pset5/fuel/test_fuel.py index f812045..914d98d 100644 --- a/pset5/fuel/test_fuel.py +++ b/pset5/fuel/test_fuel.py @@ -5,6 +5,7 @@ def test_input(): assert convert('1/2') == 50 assert convert('1/1') == 100 assert convert('0/10') == 0 + assert convert('1/4') == 25 def test_errors(): with pytest.raises(ZeroDivisionError): diff --git a/pset5/twttr/test_twttr.py b/pset5/twttr/test_twttr.py index 9ed06f4..9507762 100644 --- a/pset5/twttr/test_twttr.py +++ b/pset5/twttr/test_twttr.py @@ -4,6 +4,7 @@ def test_nonAlpha(): assert shorten('$twenty-five') == '$twnty-fv' assert shorten('25 dollars') == '25 dllrs' assert shorten('$25.00') == '$25.00' + assert shorten('twenty dollars') == 'twnty dllrs' def test_consonants(): assert shorten('tstst') == 'tstst' From 4669912adb6beb3e88dc5b391e80777bb45004a6 Mon Sep 17 00:00:00 2001 From: P Laaveshwaran Date: Sun, 27 Jul 2025 14:15:35 +0530 Subject: [PATCH 2/2] Update pset1/extensions.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- pset1/extensions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pset1/extensions.py b/pset1/extensions.py index 8e2f6cf..5912196 100644 --- a/pset1/extensions.py +++ b/pset1/extensions.py @@ -21,7 +21,7 @@ -# this method is more easier and allows a broader list instead of if-else everything. +# this method is easier and allows a broader list instead of if-else everything. types = { "gif": "image/gif", "jpg": "image/jpeg",