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 011018c commit ef2a1aaCopy full SHA for ef2a1aa
brain_games/games/brain_calc.py
@@ -7,14 +7,14 @@
7
8
# Question and correct answer generator for Calc game.
9
def generate_question():
10
- ops = {'+': operator.add,
+ operations = {'+': operator.add,
11
'-': operator.sub,
12
'*': operator.mul
13
}
14
- ops_symbols = random.choice(list(ops.keys()))
+ op_symbol = random.choice(list(operations.keys()))
15
num1 = random.randint(1, 25)
16
num2 = random.randint(1, 25)
17
- operator_func = ops[ops_symbols]
18
- question = f"{num1} {ops_symbols} {num2}"
+ operator_func = operations[op_symbol]
+ question = f"{num1} {op_symbol} {num2}"
19
correct_answer = operator_func(num1, num2)
20
return question, correct_answer
0 commit comments