Skip to content

Mickey🍉 #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion pset1/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,22 @@
elif filetype == '.zip':
print('application/zip')
else :
print('application/octet-stream')
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"))
4 changes: 3 additions & 1 deletion pset3/outdated.py
Original file line number Diff line number Diff line change
Expand Up @@ -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='-')

Expand Down
1 change: 1 addition & 0 deletions pset5/bank/test_bank.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions pset5/fuel/test_fuel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions pset5/twttr/test_twttr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down