Skip to content

Commit b2398f1

Browse files
author
meshmote
committed
Added slicing lab file
1 parent 0ebcc3b commit b2398f1

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
def first_last(k):
2+
return k[-1] + k[1:-1] + k[0]
3+
4+
5+
def eo_out(k):
6+
return k[0:13:2]
7+
8+
9+
def eo_middle(k):
10+
return k[4:-4:2]
11+
12+
13+
def revstring(k):
14+
return k[::-1]
15+
16+
17+
def midlasfir(k):
18+
return
19+
20+
21+
22+
# Testing Block
23+
if __name__ == "__main__":
24+
assert first_last('This is a test') == "this is a tesT"
25+
assert eo_out('This is a test') == "Ti sats"
26+
assert eo_middle('This is a test') == ' sa'
27+
assert revstring('This is a test') == 'tset a si sihT'

0 commit comments

Comments
 (0)