题目:

Modify the spacify function so that it returns the given string with spaces insertedbetween each character.

spacify("hello world") # returns "h e l l o   w o r l d"

解题办法:

def spacify(string):
#your code here
return ' '.join(list(string))

用时:5分59秒

知识点:

1、str转化为list:list(str)

2、list转化为str:''.join(list)

【Kata Daily 190918】Spacify(插空)的更多相关文章

  1. 【Kata Daily 190929】Password Hashes(密码哈希)

    题目: When you sign up for an account somewhere, some websites do not actually store your password in ...

  2. 【Kata Daily 190903】String incrementer(字符串增量器)

    原题: Your job is to write a function which increments a string, to create a new string. If the string ...

  3. 【Kata Daily 191012】Find numbers which are divisible by given number

    题目: Complete the function which takes two arguments and returns all numbers which are divisible by t ...

  4. 【Kata Daily 191010】Grasshopper - Summation(加总)

    题目: Summation Write a program that finds the summation of every number from 1 to num. The number wil ...

  5. 【Kata Daily 190927】Counting sheep...(数绵羊)

    题目: Consider an array of sheep where some sheep may be missing from their place. We need a function ...

  6. 【Kata Daily 190924】Difference of Volumes of Cuboids(长方体的体积差)

    题目: In this simple exercise, you will create a program that will take two lists of integers, a and b ...

  7. 【Kata Daily 190923】Odder Than the Rest(找出奇数)

    题目: Create a method that takes an array/list as an input, and outputs the index at which the sole od ...

  8. 【Kata Daily 190920】Square(n) Sum(平方加总)

    题目: Complete the square sum function so that it squares each number passed into it and then sums the ...

  9. 【Kata Daily 190919】Sort Out The Men From Boys(排序)

    题目: Scenario Now that the competition gets tough it will Sort out the men from the boys . Men are th ...

随机推荐

  1. 02 Writing Your First Program 写你的第一个C程序

    Let's print "Hi" 打印输出"Hi" In your first computer program, let's print something ...

  2. visual studio 2015 安装MSDN全称Microsoft Developer Network 安装离线的MSDN

    MSDN: 微软向开发人员提供的一套帮助系统,其中包含大量的开发文档,技术文章和示例代码. 这里介绍了vs2015 装离线的MSDN(说明一点是,如果不行,说明你的文件有缺陷,没安装好,之前我用vs2 ...

  3. Arduino 模拟引脚

    Arduino的模拟引脚的引用,网上不错的一篇文章 参考:http://blog.sina.com.cn/s/blog_156e62ef90102xjio.html 模拟引脚 本文是对于Arduino ...

  4. 【学习笔记/题解】虚树/[SDOI2011]消耗战

    题目戳我 \(\text{Solution:}\) 题目很显然可以设\(dp[i]\)表示\(i\)的子树内的关键点都不和\(i\)联通的最小待机,有如下\(dp\)方程: \(v\in son_u, ...

  5. 题解 CF149D

    题目链接 首先,这是一道区间dp题: 首先我们假设 \(l\) ~ \(r\) 是一段合法的区间: 考虑状态,对于一个区间 \(l\) ~ \(r\) 的方案数,我们需要知道方案数,以及 \(l ,r ...

  6. IO那些事

    IO(Input\Output): 即输入输出,通常指数据在存储器(内部和外部)或其他周边设备之间的输入和输出,是信息处理系统(例如计算机)与外部世界(可能是人类或另一信息处理系统)之间的通信.说的简 ...

  7. background-size 详解

    backgroun-size:cover; .是按照等比缩放铺满整个区域.主要用于图片比div小的时候,将图片按照某一边的比例扩大以填充整个div背景. .优点:图片不会被拉升,且实用于div长度和宽 ...

  8. 多测师讲解selenium _下拉框的定位_高级讲师肖sir

    from selenium import webdriver from selenium.webdriver.support.ui import Select#导入类from time import ...

  9. 2020年sublime text3可用的注册码

    2020年sublime text3可用的注册码 最近终于找到可以用的sublime text3注册码了,仅供各位同学交流学习使用.用完请删除,购买正版! ----- BEGIN LICENSE -- ...

  10. spring boot:用shardingjdbc实现多数据源的分库分表(shardingsphere 4.1.1/spring boot 2.3.1)

    一,shardingjdbc的用途 1,官方站介绍: Apache ShardingSphere 是一套开源的分布式数据库中间件解决方案组成的生态圈, 它由 JDBC.Proxy 和 Sidecar( ...