MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / apply_table

Function apply_table

other/sdes.py:1–11  ·  view source on GitHub ↗

>>> apply_table("0123456789", list(range(10))) '9012345678' >>> apply_table("0123456789", list(range(9, -1, -1))) '8765432109'

(inp, table)

Source from the content-addressed store, hash-verified

1def apply_table(inp, table):
2 """
3 >>> apply_table("0123456789", list(range(10)))
4 '9012345678'
5 >>> apply_table("0123456789", list(range(9, -1, -1)))
6 '8765432109'
7 """
8 res = ""
9 for i in table:
10 res += inp[i - 1]
11 return res
12
13
14def left_shift(data):

Callers 2

functionFunction · 0.85
sdes.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected