RosettaCodeData/Task/Substring-Top-and-tail/Python/substring-top-and-tail-1.py

4 lines
155 B
Python
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
print "knight"[1:] # strip first character
print "socks"[:-1] # strip last character
print "brooms"[1:-1] # strip both first and last characters