题目
题目

Combined CS-126 sections - (1257-4967) COMPUTER SCIENCE I (Fall 2025 M16) 002 Unit 07 - Task | Retention Quiz

单项选择题

What is displayed by the following code? Aspen_colors = ("green", "yellow", "orange", "white") Aspen_colors.append("red") result = Aspen_colors[4] print(result)

选项
A.'red'
B.TypeError: can only concatenate tuple (not "str") to tuple
C.AttributeError: 'tuple' object has no attribute 'append'
D.'white'
查看解析

查看解析

标准答案
Please login to view
思路分析
The code snippet uses a tuple and attempts an operation that tuples do not support, so careful consideration of each option is needed before selecting. Option 1: 'red' — This would be the expected output if the code could append 'red' to the tuple and then access index 4. However, the immediate issue is that tuples are immutable and do not have an append method. Since Aspen_colors is a tuple,......Login to view full explanation

登录即可查看完整答案

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

更多留学生实用工具

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