Python|Python list slicing

7.list slicing syntax
str[start:end:stride]
8.omitting indices
to_five= ["a","b","c","d","e"]
print to_five[3:]
print ["d","e"] print to_five[:2]
print ["a","b"] print to_five[::2]
print ["a","c","e"] 1.the default starting index is 0
2.the default ending index is the end of the list
3.the default stride is 1
9.reversing a list
letters =["a","b","c"]
print letters[::-1]
print out ["c","b","a"]
10.stride length
createa variable backwards_by_tens,and set it equal to the result of going backwards through to_one_hundred by tens.
go ahead and print backwards_by_tens to the console.
to_one_hundred = range(101)
backwards_by_tens = to_one_hundred[100::-10]
tens没注意,步数写错了
17.list slicing
garbled ="!xexgxaxsxsxexmx xtxexrxcxexsx xexhxt xmxax xl" message = garbled[::-2]
我的解法
【Python|Python list slicing】message = garbled[:45:-1] + " am the secret message!"
看错误提醒是要输出"l am the secret message!" 只看到了l,然后看问答版块才知道原来里面隐藏了"l am the secret message!"

    推荐阅读