官术网_书友最值得收藏!

Negative syntax

One more thing you can do is have this negative syntax:

x[-2:]

The output is as follows:

[5, 6]

By saying x[-2:], this means that I want the last two elements in the list. This means that go backwards two from the end, and that will give me 5 and 6, because those are the last two things on my list.

主站蜘蛛池模板: 桂林市| 沅江市| 开封县| 孟州市| 隆化县| 宝丰县| 阿拉尔市| 台东县| 九台市| 阿尔山市| 广德县| 泗水县| 高安市| 三明市| 宝山区| 海伦市| 东海县| 闻喜县| 且末县| 榕江县| 通道| 双江| 陆丰市| 大英县| 湖南省| 武夷山市| 淳安县| 高雄市| 柳林县| 无极县| 延长县| 浦城县| 特克斯县| 旺苍县| 山西省| 宁陕县| 沐川县| 厦门市| 常山县| 聊城市| 武城县|