diff options
| author | 2021-05-09 17:36:27 -0300 | |
|---|---|---|
| committer | 2021-05-09 17:36:27 -0300 | |
| commit | c57a8557f0f52ab35c9ef79c6894bad04f73c8d2 (patch) | |
| tree | 448858bb864080511b146644840dc5f9965c1235 /bot | |
| parent | use dict.get for retrieving a default value instead of a condition (diff) | |
use `operator` module instead of lambda functions
Diffstat (limited to 'bot')
| -rw-r--r-- | bot/exts/evergreen/trivia_quiz.py | 7 | 
1 files changed, 4 insertions, 3 deletions
diff --git a/bot/exts/evergreen/trivia_quiz.py b/bot/exts/evergreen/trivia_quiz.py index 6f39d9f2..10237be9 100644 --- a/bot/exts/evergreen/trivia_quiz.py +++ b/bot/exts/evergreen/trivia_quiz.py @@ -2,6 +2,7 @@ import asyncio  import json  import logging  import random +import operator  from pathlib import Path  from typing import List, Optional, Tuple @@ -119,9 +120,9 @@ def binary_calc(q_format: str, a_format: str) -> Tuple[str, str]:      b = random.randint(10, a)      oper = random.choice(          ( -            ("+", lambda x, y: x + y), -            ("-", lambda x, y: x - y), -            ("*", lambda x, y: x * y), +            ("+", operator.add), +            ("-", operator.sub), +            ("*", operator.mul),          )      )  |