Skip to content

Commit 59def6e

Browse files
committed
fix lint
1 parent 857021f commit 59def6e

File tree

6 files changed

+30
-26
lines changed

6 files changed

+30
-26
lines changed

brain_games/games/brain_calc.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
from brain_games.sample import gen_rand_num
1+
import random
22
from brain_games.sample import samples
33

44

55
CON_ANSWER = 'What is the result of the expression?'
66

77

8-
def type_brain_calc(numbers):
8+
def type_brain_calc():
99
correct_answer = ''
10-
first_number, sec_number, arithmetic_operation = numbers
10+
first_number = random.randint(1, 25)
11+
sec_number = random.randint(1, 25)
12+
arithmetic_operation = random.choice(['-', '+', '*'])
1113
match arithmetic_operation:
1214
case '+':
1315
correct_answer = first_number + sec_number
@@ -20,8 +22,8 @@ def type_brain_calc(numbers):
2022

2123

2224
def main():
23-
samples(CON_ANSWER, type_brain_calc(gen_rand_num()),
24-
type_brain_calc(gen_rand_num()), type_brain_calc(gen_rand_num()))
25+
samples(CON_ANSWER, type_brain_calc(),
26+
type_brain_calc(), type_brain_calc())
2527

2628

2729
if __name__ == '__main__':

brain_games/games/brain_even.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
from brain_games.sample import gen_rand_num
1+
import random
22
from brain_games.sample import samples
33

44

55
CON_ANSWER = 'Answer "yes" if the number is even, otherwise answer "no".'
66

77

8-
def type_brain_even(numbers):
9-
first_number, sec_number, arithmetic_operation = numbers
8+
def type_brain_even():
9+
first_number = random.randint(1, 50)
1010
corr_ans = 'yes' if first_number % 2 == 0 else 'no'
1111
return (corr_ans,
1212
f'Question: {first_number}')
1313

1414

1515
def main():
16-
samples(CON_ANSWER, type_brain_even(gen_rand_num()),
17-
type_brain_even(gen_rand_num()), type_brain_even(gen_rand_num()))
16+
samples(CON_ANSWER, type_brain_even(),
17+
type_brain_even(), type_brain_even())
1818

1919

2020
if __name__ == '__main__':

brain_games/games/brain_gcd.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
from brain_games.sample import gen_rand_num
1+
import random
22
from brain_games.sample import samples
33

44

55
CON_ANSWER = 'Find the greatest common divisor of given numbers.'
66

77

8-
def type_brain_gcd(numbers):
9-
frs_num, sec_num, arithmetic_operation = numbers
8+
def type_brain_gcd():
9+
frs_num = random.randint(1, 50)
10+
sec_num = random.randint(1, 50)
1011
re = []
1112
max_num = max(frs_num, sec_num)
1213
for i in range(1, max_num + 1):
@@ -17,8 +18,8 @@ def type_brain_gcd(numbers):
1718

1819

1920
def main():
20-
samples(CON_ANSWER, type_brain_gcd(gen_rand_num()),
21-
type_brain_gcd(gen_rand_num()), type_brain_gcd(gen_rand_num()))
21+
samples(CON_ANSWER, type_brain_gcd(),
22+
type_brain_gcd(), type_brain_gcd())
2223

2324

2425
if __name__ == '__main__':

brain_games/games/brain_prime.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
from brain_games.sample import gen_rand_num
1+
import random
22
from brain_games.sample import samples
33

44

55
CON_ANSWER = 'Answer "yes" if given number is prime. Otherwise answer "no".'
66

77

8-
def type_brain_prime(numbers):
9-
num, sec_number, arithmetic_operation = numbers
8+
def type_brain_prime():
9+
num = random.randint(1, 25)
1010
re = []
1111
for i in range(1, num + 1):
1212
if num % i == 0:
@@ -17,8 +17,8 @@ def type_brain_prime(numbers):
1717

1818

1919
def main():
20-
samples(CON_ANSWER, type_brain_prime(gen_rand_num()),
21-
type_brain_prime(gen_rand_num()), type_brain_prime(gen_rand_num()))
20+
samples(CON_ANSWER, type_brain_prime(),
21+
type_brain_prime(), type_brain_prime())
2222

2323

2424
if __name__ == '__main__':

brain_games/games/brain_progression.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import random
2-
from brain_games.sample import gen_rand_num
32
from brain_games.sample import samples
43

54

65
CON_ANSWER = 'What number is missing in the progression?'
76

87

9-
def type_brain_progress(numbers):
10-
first_num, sec_number, arithmetic_operation = numbers
8+
def type_brain_progress():
9+
first_num = random.randint(1, 50)
1110
re = []
1211
range_progressing = random.randint(5, 10)
1312
sec_num = random.randint(1, 5)
@@ -24,9 +23,9 @@ def type_brain_progress(numbers):
2423

2524

2625
def main():
27-
samples(CON_ANSWER, type_brain_progress(gen_rand_num()),
28-
type_brain_progress(gen_rand_num()),
29-
type_brain_progress(gen_rand_num()))
26+
samples(CON_ANSWER, type_brain_progress(),
27+
type_brain_progress(),
28+
type_brain_progress())
3029

3130

3231
if __name__ == '__main__':

brain_games/sample.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import prompt
2+
3+
24
NUMBERS_OF_ATTEMPTS = 3
35

46

0 commit comments

Comments
 (0)