2020年4月7日

输入一个数字,求每一位相加之和

摘要: 题目描述: # In this kata, you must create a digital root function.## A digital root is the recursive sum of all the digits in a number. Given n, take the 阅读全文

posted @ 2020-04-07 20:06 阿虾 阅读(476) 评论(0) 推荐(0) 编辑

判断一个数是否为素数

摘要: 我的解答: import mathdef is_prime(n): if n > 1: if n == 2: return True if n % 2 == 0: return False for current in range(3, int(math.sqrt(n) + 1), 2): if n 阅读全文

posted @ 2020-04-07 16:57 阿虾 阅读(226) 评论(0) 推荐(0) 编辑

编写一个函数,它接受一个或多个单词的字符串,并返回相同的字符串,但所有五个或多个字母的单词都颠倒过来

摘要: 题目描述: # Write a function that takes in a string of one or more words, and returns the same string, but with all five or more letter words reversed (Ju 阅读全文

posted @ 2020-04-07 16:53 阿虾 阅读(815) 评论(0) 推荐(0) 编辑

导航