Courcera题目集锦(一)

  1. What is the result of the following operation:
    [1,2,3]+[1,1,1]
  • [2,3,4]
  • [1, 2, 3, 1, 1, 1]
  • TypeError

正确答案:[1, 2, 3, 1, 1, 1]

  1. What is the length of the list A = [1] after the following operation:
    A.append([2,3,4,5])
  • 5
  • 6
  • 2

正确答案:2
append-only adds one element to the list

  1. What is the result of the following:
    "Hello Mike".split()
  • ["Hello","Mike"]
  • ["HelloMike"]
  • ["H"]

正确答案:["Hello","Mike"]
the method split separates a string into a list based on the argument. If there is no argument as in this case the string is split using spaces.

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容