Python入门实战:Round 6
哈,这个系列是跟小伙伴一起组织的Python兴趣小组的习题,每一期内容会包括三个部分:题目、小伙伴答案和全球开发者答案。话不多说,Show you the code ~
工具/原料
题目来源:Codewars
Python 2.7
Round 6# Find the divisors!
Create a function named divisors that takes an integer and returns an array with all of the integer's divisors(except for 1 and the number itself). If the number is prime return the string '(integer) is prime'
用到点数学知识,有小伙伴开始紧张了哈哈哈
Local answers
大家开始习惯对简单的问题用一两行代码说清楚了
一对相同的代码,可读性还是不错的,思路清晰
对于代码篇幅来说,可以看出是否使用列表生成式差别很大
Global answers
阅读文章的同学,你们的代码跟下面哪个答案相似呢?
注意事项
代码下载:https://pan.baidu.com/s/1qZOzLNm
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:36
阅读量:30
阅读量:50
阅读量:27
阅读量:99