We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7530a41 commit aa01df8Copy full SHA for aa01df8
1 file changed
maths/triplet_sum.py
@@ -12,6 +12,30 @@
12
13
14
def make_dataset() -> tuple[list[int], int]:
15
+ """
16
+ Generates a random dataset.
17
+
18
+ Returns a tuple where:
19
+ - The first element is a list of 10 integers, each between -1000 and 1000.
20
+ - The second element is a single integer between -5000 and 5000.
21
22
+ Example usage (outputs will vary because of randomness):
23
+ >>> arr, r = make_dataset()
24
+ >>> isinstance(arr, list)
25
+ True
26
+ >>> len(arr)
27
+ 10
28
+ >>> all(isinstance(x, int) for x in arr)
29
30
+ >>> isinstance(r, int)
31
32
+ >>> -1000 <= min(arr) <= 1000
33
34
+ >>> -1000 <= max(arr) <= 1000
35
36
+ >>> -5000 <= r <= 5000
37
38
39
arr = [randint(-1000, 1000) for i in range(10)]
40
r = randint(-5000, 5000)
41
return (arr, r)
0 commit comments