Skip to content

Commit c61582e

Browse files
committed
Initial commit
0 parents  commit c61582e

File tree

5 files changed

+4986
-0
lines changed

5 files changed

+4986
-0
lines changed

dic.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
a = dict(one=1, two=2, three=3)
2+
b = {'one': 1, 'two': 2, 'three': 3}
3+
c = dict(zip(['one', 'two', 'three'], [1, 2, 3]))
4+
d = dict([('two', 2), ('one', 1), ('three', 3)])
5+
e = dict({'three': 3, 'one': 1, 'two': 2})
6+
print(a == b == c == d == e)

encrypted.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
t#N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N#A44444444444444444444444444444444A#N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N##N#t44ACbaaaaaaaaaaaaaaaaaaaaaaaaabB44444444444tA4444BB44444444444tbaaaaaaaaaaaaaaaaaaaaaaaaab?A444444AƒxbaaaaaaaaaaaaaaaaaaaaaaaxB4444444444#N#ttttC4444444444t|aaaaaaaaaaaaaaaaaaaaaaabƒA444444444#N#baaaaaaaaaaaaaaaaaaaaaaƒAtt444444?abbbbaƒ444444ttBƒaaaaaaaaaaaaaaaaaaaaaab#N#44444444444A|aaaaaaaaaaaaaaaaaaaaaaaax|‡‡‡‡aaaaaa‡‡‡‡|xaaaaaaaaaaaaaaaaaaaaaaaa|A4444444444444‡aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa‡t44444444444444aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|44444444444444Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa#N#44444444444444BaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaA44444444444444#N#bbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbC44444444444444tBBBBBBBBBBBBAA#N#C?ƒ|xbaaaaaaaaaaaaaaaaaaaaaaaabx|ƒ?C#N#AABBBBBBBBBBBBt44444444444444444444444444444444444tBA?aaaaaaaaaaaaaaaa?#N#Bt4444444444444444444444444444444444444444t#N#‡aaaaaaaaaa‡#N#t4444444444444444444444444444444444444444444t?aaaaaaƒB444444444444444444444444444444444444444444444BaaaaB44444444444444444444444444444444444444444444444ƒaaƒ444444444444444444444444444444444444444444444444‡‡4444444444444444444444444444444444444444444444444t

itws.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from functools import reduce, partial
2+
from operator import add
3+
4+
def compose(*fns):
5+
compose_binary = lambda f, g: lambda x: f(g(x))
6+
return reduce(compose_binary, fns, lambda x: x)
7+
8+
def edit_distance(s1,s2):
9+
if len(s1) > len(s2):
10+
s1,s2 = s2,s1
11+
distances = range(len(s1) + 1)
12+
for index2,char2 in enumerate(s2):
13+
newDistances = [index2+1]
14+
for index1,char1 in enumerate(s1):
15+
if char1 == char2:
16+
newDistances.append(distances[index1])
17+
else:
18+
newDistances.append(1 + min((distances[index1],
19+
distances[index1+1],
20+
newDistances[-1])))
21+
distances = newDistances
22+
return distances[-1]

object-ref-passed-by-value.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
def reassign(lis):
2+
lis = ['a', 'b']
3+
4+
def mutate(lis):
5+
lis.append('b')
6+
7+
8+
l = ['a']
9+
reassign(l)
10+
print(l)
11+
mutate(l)
12+
print(l)

0 commit comments

Comments
 (0)