Skip to content

Commit d719deb

Browse files
committed
filally understand
1 parent 80c491d commit d719deb

File tree

6 files changed

+8
-15
lines changed

6 files changed

+8
-15
lines changed

brain_games/games/brain_calc.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ def type_brain_calc():
2222

2323

2424
def main():
25-
samples(CON_ANSWER, type_brain_calc(),
26-
type_brain_calc(), type_brain_calc())
25+
samples(CON_ANSWER, type_brain_calc)
2726

2827

2928
if __name__ == '__main__':

brain_games/games/brain_even.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ def type_brain_even():
1313

1414

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

1918

2019
if __name__ == '__main__':

brain_games/games/brain_gcd.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ def type_brain_gcd():
1818

1919

2020
def main():
21-
samples(CON_ANSWER, type_brain_gcd(),
22-
type_brain_gcd(), type_brain_gcd())
21+
samples(CON_ANSWER, type_brain_gcd)
2322

2423

2524
if __name__ == '__main__':

brain_games/games/brain_prime.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ def type_brain_prime():
1717

1818

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

2322

2423
if __name__ == '__main__':

brain_games/games/brain_progression.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ def type_brain_progress():
2323

2424

2525
def main():
26-
samples(CON_ANSWER, type_brain_progress(),
27-
type_brain_progress(),
28-
type_brain_progress())
26+
samples(CON_ANSWER, type_brain_progress)
2927

3028

3129
if __name__ == '__main__':

brain_games/sample.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
NUMBERS_OF_ATTEMPTS = 3
44

55

6-
def samples(condition_answer, answ_and_qest, answ_and_qest2, answ_and_qest3):
6+
def samples(condition_answer, answ_and_qest):
77
print('Welcome to the Brain Games!')
88
name = prompt.string('May I have your name? ')
99
print(f'Hello, {name}!')
1010
number_of_successful_attempts = 0
1111
print(condition_answer)
12-
correct_answer, question = answ_and_qest
12+
1313
for _ in range(NUMBERS_OF_ATTEMPTS):
14+
correct_answer, question = answ_and_qest()
1415
print(question)
1516
answer = input('Your answer: ')
1617
if answer == str(correct_answer):
@@ -21,7 +22,5 @@ def samples(condition_answer, answ_and_qest, answ_and_qest2, answ_and_qest3):
2122
f" '{correct_answer}'\n"
2223
f"Let's try again, {name}!")
2324
break
24-
correct_answer, question = answ_and_qest3\
25-
if number_of_successful_attempts == 2 else answ_and_qest2
2625
if number_of_successful_attempts == NUMBERS_OF_ATTEMPTS:
2726
print(f'Congratulations, {name}!')

0 commit comments

Comments
 (0)