Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b9d61f9

Browse files
committed
finish three 6kyu , one beta
1 parent 24e1a27 commit b9d61f9

File tree

4 files changed

+67
-0
lines changed

4 files changed

+67
-0
lines changed

β€Ž[6 kyu]Custom Array Filters.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class list(object):
2+
def __init__(self, arg):
3+
self.arg = [c for c in arg if isinstance(c,int)]
4+
def even(self):
5+
return [n for n in self.arg if n % 2 == 0]
6+
def odd(self):
7+
return [n for n in self.arg if n % 2 != 0]
8+
def under(self,num):
9+
return [n for n in self.arg if n < num]
10+
def over(self,num):
11+
return [n for n in self.arg if n > num]
12+
def in_range(self,min,max):
13+
return [n for n in self.arg if n >= min and n <= max]

β€Ž[6 kyu]Secret Message.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
def find_secret_message(paragraph):
2+
paragraph = ''.join([c for c in paragraph.lower() if c in 'abcdefghijklmnopqrstuvwxyz -'])
3+
appear,res = [],[]
4+
for word in paragraph.split():
5+
if word not in appear:
6+
appear.append(word)
7+
elif word not in res:
8+
res.append(word)
9+
return ' '.join(res)
10+
11+
12+
print(find_secret_message('asdf qwer zxcv. zxcv fdsa rewq. qazw asdf sxed. qwer crfv.'))

β€Ž[6 kyu]Unary function chainer.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
def chained(f):
2+
z = lambda x:x
3+
for func in f:
4+
func(z)
5+
return z
6+
7+
8+
9+
10+
11+
def f1(x): return x*2
12+
def f2(x): return x+2
13+
def f3(x): return x**2
14+
def f4(x): return x.split()
15+
def f5(xs): return [x[::-1].title() for x in xs]
16+
def f6(xs): return "_".join(xs)
17+
18+
print(chained([f1,f2,f3])(0)) #4
19+

β€Ž[beta]Vasya - Clerk.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
def tickets(people):
2+
cashier = {100:0,50:0,25:0}
3+
for pay in people:
4+
if pay == 25:
5+
cashier[25] += 1
6+
elif pay == 50:
7+
if cashier[25] == 0:
8+
return 'NO'
9+
cashier[50] += 1
10+
cashier[25] -= 1
11+
else:
12+
cashier[100] += 1
13+
if cashier[50] >= 1 and cashier[25] >= 1:
14+
cashier[50] -= 1
15+
cashier[25] -= 1
16+
elif cashier[25] >= 3:
17+
cashier[25] -= 3
18+
else:
19+
return 'NO'
20+
return 'YES'
21+
22+
23+
print(tickets([25,25,25,100,25,50]))

0 commit comments

Comments
(0)

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /