From 1854cd45dc4b79bed492a95bd00bcadf8ff116af Mon Sep 17 00:00:00 2001 From: Objectivitix <79152594+Objectivitix@users.noreply.github.com> Date: Sun, 9 May 2021 14:00:08 -0400 Subject: use random.sample for more concise expression on line 66 Co-authored-by: Anand Krishna <40204976+anand2312@users.noreply.github.com> --- bot/exts/evergreen/trivia_quiz.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'bot') diff --git a/bot/exts/evergreen/trivia_quiz.py b/bot/exts/evergreen/trivia_quiz.py index 5553898d..620a4377 100644 --- a/bot/exts/evergreen/trivia_quiz.py +++ b/bot/exts/evergreen/trivia_quiz.py @@ -63,8 +63,7 @@ def linear_system(q_format: str, a_format: str) -> Tuple[str, str]: x, y = random.randint(2, 5), random.randint(2, 5) answer = a_format.format(x, y) - nums = [i for i in range(1, 6)] - coeffs = [nums.pop(random.randint(0, len(nums) - 1)) for _ in range(4)] + coeffs = random.sample(range(1, 6), 4) question = q_format.format( coeffs[0], -- cgit v1.2.3