Skip to content

Commit f2a337c

Browse files
authored
Merge pull request #13 from aviiciii:update
Update from Mickey
2 parents 6e8557e + ab29bfa commit f2a337c

File tree

5 files changed

+18
-20
lines changed

5 files changed

+18
-20
lines changed

pset1/extensions.py

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
1-
filename=input ('File: ').lower().strip()
1+
types = {
2+
"gif": "image/gif",
3+
"jpg": "image/jpeg",
4+
"jpeg": "image/jpeg",
5+
"png": "image/png",
6+
"pdf": "application/pdf",
7+
"txt": "text/plain",
8+
"zip": "application/zip",
9+
"mp4": "video/mp4",
10+
"csv": "text/csv",
11+
}
212

3-
dot=filename.rfind('.')
4-
5-
filetype=filename[dot:]
6-
7-
if filetype == '.jpg' or filetype == '.jpeg':
8-
print('image/jpeg')
9-
elif filetype == '.gif':
10-
print('image/gif')
11-
elif filetype == '.png':
12-
print('image/png')
13-
elif filetype == '.pdf':
14-
print('application/pdf')
15-
elif filetype == '.txt':
16-
print('text/plain')
17-
elif filetype == '.zip':
18-
print('application/zip')
19-
else :
20-
print('application/octet-stream')
13+
s = input("File name: ").strip().lower().split(".")[-1]
14+
print(types.get(s, "application/octet-stream"))

pset3/outdated.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
break
3939
except:
4040
pass
41-
elif date_type == 1:
41+
42+
if date_type == 1:
4243
month_no = str(month.index(date[0])+1)
4344
print(date[2].zfill(4), month_no.zfill(2), date[1].zfill(2), sep='-')
4445

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)