Which list comprehension below would generate the following output? [0, 1, 4, 9, 16, 25, 36, 0, 0, 0] 单项选择题
A
[0 if i>6 else i**2 for i in range(11)]
B
[i**2 if i<6 else 0 for i in range(10)]
C
[0 if i>6 else i**2 for i in range(10)]
登录即可查看完整答案
我们收录了全球超50000道真实原题与详细解析,现在登录,立即获得答案。
类似问题
Q31. Which of the following list comprehensions is equivalent to this loop? result = [] for x in range(5): result.append(x * 2)
Question at position 21 Given a list xs, which of the following Haskell functions correctly computes a list of differences between each pair of consecutive elements? For example, given xs = [3, 8, 14, 20], the function should return [5, 6, 6]. (Note: the sign is important, the output should not be [-5, -6, -6])Clear my selection
What will the following list comprehension return?
Which of the following list should replace ??? to get [5,6,6,7] as the result?
更多留学生实用工具
希望你的学习变得更简单
加入我们,立即解锁 海量真题 与 独家解析,让复习快人一步!