PROBLEM SET
负索引
按知识点筛选题目,系统巩固该考点。
题目列表
共 10 题
A58776
运行如下代码:words = "123abc"slice1=words[-1::-1]print(slice1)结果为:“cba321”。( )
2022年
--
--
A57660
s='happy birthday'
2023年-选择题
--
--
A57603
有列表L=['UK','china','lili',"张三"],print(L[-2])的结果是?
2023年-选择题
--
--
A59105
已知a=[1,2,3,4,5,6,7],则a[0:-2]的的值是?( )
2021年
--
--
A59075
设s="happy time",那么print(s[-2:])的结果是?( )
2021年
--
--
A57445
执行以下运算后,text2的值是?( )text1 = "Good work" text2 = text1[-1]*3
2023年-选择题
--
--
A57165
列表a=[1,2,3,4,5,6],则与a[::-1][-1]的结果相同的表达式是?( )
2023年-选择题
--
--
A60080
定义元组 tup1 = ('快乐', '你好', '生日', '中国', '祖国', '祝福'),执行语句:print( tup1[-5] + tup1[3] ),得到的结果是?( )
2024年-选择题
--
--
A60612
在Python中,字符串s="hello"的最后一个字符可以通过s[-1] 访问。( )
2025年
--
--
A60559
给定字符串s= "Artificial Intelligence",如何利用负索引获取子字符串"Intelligence"?( )
2025年
--
--