summaryrefslogtreecommitdiff
path: root/comp/work/10/railfence.py
blob: c91d4916d25d9f03f9594233b4b0c81a18be4143 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
string = "HELLO_THERE"
shift = 4 
hidden = []
tmp = ""
for i in string:
    if len(tmp) + 1 > shift:
        hidden.append(tmp)
        tmp = ""
    tmp = tmp + i
if len(tmp) != 0:
    hidden.append(tmp)
final = []
for i in range(shift):
    for j in hidden:
        try:
            final.append(j[i])
        except:
            pass
print(final)