We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 079f5da commit 91d319fCopy full SHA for 91d319f
task_2.py
@@ -2,12 +2,11 @@
2
3
4
def get_numbers_ticket(min, max, quantity):
5
- if not 1 <= min <= max <= 1000 and quantity > (max - min + 1):
6
- return []
7
-
8
- random_numbers = random.sample(range(min, max + 1), quantity)
9
- random_numbers.sort()
10
- return random_numbers
+ if 1 <= min <= max <= 1000 and quantity <= (max - min):
+ random_numbers = random.sample(range(min, max), quantity)
+ random_numbers.sort()
+ return random_numbers
+ return []
11
12
13
lottery_numbers = get_numbers_ticket(1, 49, 6)
0 commit comments