Skip to content

Commit 799a385

Browse files
committed
Mickey🍉
1 parent 6e8557e commit 799a385

File tree

5 files changed

+25
-2
lines changed

5 files changed

+25
-2
lines changed

‎pset1/extensions.py‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,22 @@
1717
elif filetype == '.zip':
1818
print('application/zip')
1919
else :
20-
print('application/octet-stream')
20+
print('application/octet-stream')
21+
22+
23+
24+
# this method is more easier and allows a broader list instead of if-else everything.
25+
types = {
26+
"gif": "image/gif",
27+
"jpg": "image/jpeg",
28+
"jpeg": "image/jpeg",
29+
"png": "image/png",
30+
"pdf": "application/pdf",
31+
"txt": "text/plain",
32+
"zip": "application/zip",
33+
"mp4": "video/mp4",
34+
"csv": "text/csv",
35+
}
36+
37+
s = input("File name: ").strip().lower().split(".")[-1]
38+
print(types.get(s, "application/octet-stream"))

‎pset3/outdated.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
break
3939
except:
4040
pass
41-
elif date_type == 1:
41+
42+
# error here, fixed it.
43+
if date_type == 1:
4244
month_no = str(month.index(date[0])+1)
4345
print(date[2].zfill(4), month_no.zfill(2), date[1].zfill(2), sep='-')
4446

‎pset5/bank/test_bank.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def test_h():
1414
def test_noH():
1515
assert value('whats up, buddy') == 100
1616
assert value('what the he!@') == 100
17+
assert value('what the eff') == 100
1718

1819
def test_capital():
1920
assert value('HELLO') == 0

‎pset5/fuel/test_fuel.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ def test_input():
55
assert convert('1/2') == 50
66
assert convert('1/1') == 100
77
assert convert('0/10') == 0
8+
assert convert('1/4') == 25
89

910
def test_errors():
1011
with pytest.raises(ZeroDivisionError):

‎pset5/twttr/test_twttr.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ def test_nonAlpha():
44
assert shorten('$twenty-five') == '$twnty-fv'
55
assert shorten('25 dollars') == '25 dllrs'
66
assert shorten('$25.00') == '$25.00'
7+
assert shorten('twenty dollars') == 'twnty dllrs'
78

89
def test_consonants():
910
assert shorten('tstst') == 'tstst'

0 commit comments

Comments
 (0)