File tree Expand file tree Collapse file tree 6 files changed +30
-26
lines changed Expand file tree Collapse file tree 6 files changed +30
-26
lines changed Original file line number Diff line number Diff line change 1- from brain_games . sample import gen_rand_num
1+ import random
22from brain_games .sample import samples
33
44
55CON_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
2224def 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
2729if __name__ == '__main__' :
Original file line number Diff line number Diff line change 1- from brain_games . sample import gen_rand_num
1+ import random
22from brain_games .sample import samples
33
44
55CON_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
1515def 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
2020if __name__ == '__main__' :
Original file line number Diff line number Diff line change 1- from brain_games . sample import gen_rand_num
1+ import random
22from brain_games .sample import samples
33
44
55CON_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
1920def 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
2425if __name__ == '__main__' :
Original file line number Diff line number Diff line change 1- from brain_games . sample import gen_rand_num
1+ import random
22from brain_games .sample import samples
33
44
55CON_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
1919def 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
2424if __name__ == '__main__' :
Original file line number Diff line number Diff line change 11import random
2- from brain_games .sample import gen_rand_num
32from brain_games .sample import samples
43
54
65CON_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
2625def 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
3231if __name__ == '__main__' :
Original file line number Diff line number Diff line change 11import prompt
2+
3+
24NUMBERS_OF_ATTEMPTS = 3
35
46
You can’t perform that action at this time.
0 commit comments