blob: aaef9d0a8321b2ec2a830a3f71d854e55c188924 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#!/usr/bin/python
# coding=utf-8
import random
"""This program should divide the initial number by random divisors.
Once the result is smaller than 1, the program should stop. The program is
complete apart from a loop statement. Add one on the indicated line to complete
the program.
Hint: A 'for' loop iterates a fixed number of times, and so might be
unsuitable.
"""
num = 100
# Replace this line with a loop statement.
# This prints the number, then divides it by a random number
# between 2 and 5.
print(num)
num = num / random.randint(2, 5)
|