返回顶部

收藏

Display a slice

更多
inventory = ('a',
             'b',
             'c',
             'd')

begin = int(raw_input('\nEnter the index number to begin a slice: '))
end = int(raw_input('Enter the index number to end the slice: '))
print 'inventory[', begin, ':', end, ']\t\t',
print inventory[begin:end]

标签:Python,Tuple

收藏

0人收藏

支持

0

反对

0

»更多 您可能感兴趣的代码
  1. 2016-03-12 17:48:02tuples: swaps values by jack.chen
  2. 2016-12-08 17:54:28Convert tuple to a list and sort them by 司马
  3. 2013-06-04 13:43:27web.py中自定义jinja2模块 by 赵小全
  4. 2016-12-28 20:35:28range and tuple by 大猪
  5. 2016-03-06 11:07:06Tuple indexing and slicing by 司马
  6. 2016-10-01 14:17:08Create tuple from an integer by 山药
  7. 2017-03-05 17:13:56Test for membership with in by 司马
  8. 2015-12-04 19:34:17Tuple is not changable by 西国の海妖
  9. 2017-04-02 09:05:06Indexing a single-item tuple by wubai
  10. 2013-06-05 13:21:25python 使用MySQLdb连接mysql by 玉开Sir
  11. 2016-12-04 11:48:03Treat the tuple as a condition by 阿明娃儿

发表评论