3-5 append()函数
本节编程练习不计算学习进度,请电脑登录imooc.com操作

append()函数

append() 函数是用来将某个值插入到列表中,并且处于最末位

>> append(10px 20px ,30px)
(10px 20px 30px)
>> append((10px,20px),30px)
(10px, 20px, 30px)
>> append(green,red)
(#008000 #ff0000)
>> append(red,(green,blue))
(#ff0000 (#008000, #0000ff))

如果没有明确的指定 $separator 参数值,其默认值是 auto。

当然,在 append() 函数中,可以显示的设置 $separator 参数,

>> append((blue green),red,comma)
(#0000ff, #008000, #ff0000)
>> append((blue green),red,space)
(#0000ff #008000 #ff0000)
>> append((blue, green),red,comma)
(#0000ff, #008000, #ff0000)
>> append((blue, green),red,space)
(#0000ff #008000 #ff0000)
>> append(blue,red,comma)
(#0000ff, #ff0000)
>> append(blue,red,space)
(#0000ff #ff0000)

 

任务

你可以写出下面函数运行出的结果吗?

  1.  
  2. append((blue, green),red,space)
  3.  
下一节