题目:

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. 《C++primerplus》第12章练习题

    做一下倒数两题,都是在队列模拟的程序基础上做点修改测试. 5.找出平均等候时间为1分钟时,每小时到达的客户数为多少(试验时间不少于100小时). 指定队伍最大长度10人,模拟100小时.粗略估计答案在 ...

  2. Java之格林威治时间格式转换成北京时间格式

    Java之格林威治时间格式转换成北京时间格式 package com.mtons.mblog; import java.text.ParseException; import java.text.Si ...

  3. springCloud项目搭建

    新建父maven项目 groupId:pers.xzp.springCloudartifactId:springCloud 父项目中仅仅需要一个pom文件,用于管理模块的依赖统一.继承等 编辑pom文 ...

  4. 1-kubeadm部署1.18.0单master集群

    1.有了docker,为什么还用kubernetes? 访问工具层 帮助用户更高效的完成任务,包括web控制台.RESTfulAPI.CI/CD.监控管理.日志管理 PaaS服务层 为开发.测试和运维 ...

  5. thinkphp5 chunk 分块处理数据小坑

    场景: 使用chunk方法进行分块查询写入数据,执行发现chunk分几条一次处理 数据库就插入几条,并没有return false; 代码如下 解决方法: 增加排序字段

  6. docker的run操作

    docker的run到底做了什么操作呢? 它会优先寻找本地的镜像,如果没有就到仓库找,找不到返回错误,查找不到该镜像.能找到就拉这镜像下来,以该镜像为模板生产容器实例运行. 备注:图不是自己画的,截图 ...

  7. 线程基本使用--Thread内部方法调用start

    一个问题,下面的代码会如何运行 public class TraditionalThread { public static void main(String[] args) { System.out ...

  8. 微信小程序适配iPhone X

    1.获取设备型号 App({ // 全局数据 globalData: { // 其他数据定义 ... isIPX: false, // 当前设备是否为 iPhone X }, // 小程序启动入口 o ...

  9. OpenSSL加密系统简介

    加密基本原理 OpenSSL移植到arm开发板参考  http://blog.chinaunix.net/uid-27717694-id-3530600.html 1.公钥和私钥: 公钥和私钥就是俗称 ...

  10. 利用HDFS实现ElasticSearch7.2容灾方案

    利用HDFS实现ElasticSearch7.2容灾方案 目录 利用HDFS实现ElasticSearch7.2容灾方案 前言 快照版本兼容 备份集群 HDFS文件系统 软件下载 JDK环境 配置系统 ...