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.

你可能感兴趣的:(Courcera题目集锦(一))