Skip to content

Commit 29178e1

Browse files
authored
Create day5-2.py
1 parent 34afc8d commit 29178e1

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

day5-2.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/local/bin/snek
2+
# cat day5input.txt | snek ./day5-2.py
3+
4+
def find(s, ch, start):
5+
for i in range(start, len(s)):
6+
if s[i] == ch:
7+
return i
8+
return -1
9+
10+
b = 9
11+
m = []
12+
for i in range(b):
13+
m += ['']
14+
s = input()
15+
while s[1] != '1':
16+
for i in range(b):
17+
if s[4*i+1] != ' ':
18+
m[i] = s[4*i+1] + m[i]
19+
s = input()
20+
print(m)
21+
22+
while s != None and s != '':
23+
s = input()
24+
s = input()
25+
while s != '.':
26+
print(s)
27+
i = find(s, 'e', 0)
28+
n = int(s[i+2:find(s, ' ', i+2)])
29+
i = find(s, 'm', i)
30+
f = int(s[i+2:find(s, ' ', i+2)])
31+
i = find(s, 'o', i)
32+
t = int(s[i+2:])
33+
print('%i,%i,%i' % (n, f, t))
34+
m[t-1] += m[f-1][-n:]
35+
m[f-1] = m[f-1][:-n]
36+
print(m)
37+
s = input()
38+
r = ''
39+
for s in m:
40+
r += s[-1]
41+
print(r)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy