Python-71~75

---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)