题目
题目

4510_COMP_SCI_X_0010 W05 Quiz

单项选择题

Using list slicing, how would you print ['a', 'b', 'c', 'd', 'e'] given the following list? li = ['a', 'b', 'c', 'd', 'e', 'f']

选项
A.print(li[::5])
B.print(li[5:])
C.print(li[5])
D.print(li[:5])
查看解析

查看解析

标准答案
Please login to view
思路分析
Question: Using list slicing, how would you print ['a', 'b', 'c', 'd', 'e'] given the following list? li = ['a', 'b', 'c', 'd', 'e', 'f'] Options: - print(li[::5]) - print(li[5:]) - print(li[5]) - print(li[:5]) Option 1: print(li[::5]). This uses a slice with a start of 0 (implicit), no end (implicit), and a step of 5. It would se......Login to view full explanation

登录即可查看完整答案

我们收录了全球超50000道考试原题与详细解析,现在登录,立即获得答案。

更多留学生实用工具

加入我们,立即解锁 海量真题独家解析,让复习快人一步!