美文网首页
Python-71~75

Python-71~75

作者: AoEliauk | 来源:发表于2021-02-24 15:13 被阅读0次

    ---71---

    Question:

    >Please write a program to output a random number, which is divisible by 5 and 7, between 10 and 150 inclusive using random module and list comprehension.

    Hints:

    >Use random.choice() to a random element from a list.

    Solution:


    ----72---

    Question:

    >Please write a program to generate a list with 5 random numbers between 100 and 200 inclusive.

    Hints:

    >Use random.sample() to generate a list of random values.

    Solution:


    ---73---

    Question:

    >Please write a program to randomly generate a list with 5 even numbers between 100 and 200 inclusive.

    Solution:

    解法一

    解法二


    ---74---

    Question:

    >Please write a program to randomly generate a list with 5 numbers, which are divisible by 5 and 7 , between 1 and 1000 inclusive.

    Solution:


    ---75---

    Question:

    >Please write a program to randomly print a integer number between 7 and 15 inclusive.

    Hints:

    >Use random.randrange() to a random integer in a given range.

    Solution:

    相关文章

      网友评论

          本文标题:Python-71~75

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