美文网首页CodeWars for Python
Find the divisors!----寻找除数!(Code

Find the divisors!----寻找除数!(Code

作者: Tectonic | 来源:发表于2019-04-02 11:13 被阅读0次

Description:

Create a function named divisors/Divisors that takes an integer n > 1 and returns an array with all of the integer's divisors(except for 1 and the number itself), from smallest to largest. If the number is prime return the string '(integer) is prime' (null in C#) (use Either String a in Haskell and Result<Vec<u32>, String> in Rust).

Example:

divisors(12); #should return [2,3,4,6]

divisors(25); #should return [5]

divisors(13); #should return "13 is prime"

Solutions:

Practice1:

Practice1

Practice2:

Practice2

Practice3:

Practice3

相关文章

网友评论

    本文标题:Find the divisors!----寻找除数!(Code

    本文链接:https://www.haomeiwen.com/subject/tsewbqtx.html