Kodewick
开始学 →
入门←→0 / 100

相册起名

#033入门字符串列表约 2 分钟

新建相册的名字不能有空格,所以用短横线连起来。写 join_with_dashes(words),把列表里的词用 - 连成一个字符串返回。只有一个词就是它自己,列表是空的返回 ""。

示例
join_with_dashes(["summer", "beach", "trip"])→'summer-beach-trip'
join_with_dashes(["cats"])→'cats'
main.py
def join_with_dashes(words):
    # 在这里写:用 "-" 把 words 连起来
    return ""
Ctrl + Enter 也能运行
结果

写好了先点「运行」试试示例,没问题再点「提交」。