Skip to content

Commit 7cd61cc

Browse files
author
vdz
committed
press F
1 parent f684f6f commit 7cd61cc

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

brain_games/games/brain_calc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@ def mul(num1, num2):
3232
symbol = operators[rand_operator]
3333
print(f'Question: {num1} {rand_operator} {num2}')
3434
correct_answer = symbol(num1, num2)
35+
cor_str = 'Correct answer was '
3536
user_answer = prompt.string('Your answer: ')
3637

3738
if int(user_answer) == correct_answer:
3839
print('Correct!')
3940
count += 1
4041
else:
41-
print(f"{user_answer} is wrong answer ;(. Correct answer was '{correct_answer}'.")
42+
print(f"{user_answer} is wrong answer ;(. {cor_str}'{correct_answer}'.")
4243
return print(f"Let's try again, {name}!")
4344

4445
print(f'Congratulations, {name}!')

brain_games/games/brain_even.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def even():
1616
rand_to_string = str(rand_num)
1717
print(f'Question: {rand_to_string}')
1818
user_answer = prompt.string('Your answer: ')
19+
cor_str = 'Correct answer was '
1920

2021
if rand_num % 2 == 0 and user_answer == 'yes':
2122
print('Correct!')
@@ -24,10 +25,10 @@ def even():
2425
print('Correct!')
2526
count += 1
2627
elif rand_num % 2 == 0 and user_answer == 'no':
27-
print(f"'no' is wrong answer ;(. Correct answer was 'yes'.")
28+
print(f"'no' is wrong answer ;(. {cor_str}'yes'.")
2829
return print(f"Let's try again, {name}!")
2930
elif rand_num % 2 != 0 and user_answer == 'yes':
30-
print(f"'yes' is wrong answer ;(. Correct answer was 'no'.")
31+
print(f"'yes' is wrong answer ;(. {cor_str}'no'.")
3132
return print(f"Let's try again, {name}!")
3233
else:
3334
print(f"{user_answer} is wrong answer ;(.")

brain_games/games/brain_gcd.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ def gcd():
1717
print(f'Question: {rand_num1} {rand_num2}')
1818
user_answer = prompt.string('Your answer: ')
1919
correct_answer = math.gcd(rand_num1, rand_num2)
20-
20+
cor_str = 'Correct answer was '
21+
2122
if user_answer == str(correct_answer):
2223
print('Correct!')
2324
count += 1
2425
else:
25-
print(f"'{user_answer}' is wrong answer ;(. Correct answer was '{correct_answer}'.")
26+
print(f"'{user_answer}' is wrong answer ;(. {cor_str}'{correct_answer}'.")
2627
return print(f"Let's try again, {name}!")
2728

2829
print(f'Congratulations, {name}!')

brain_games/games/brain_prime.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def prime():
1717
print(f'Question: {rand_num}')
1818
user_answer = prompt.string('Your answer: ')
1919
correct_answer = ''
20+
cor_str = 'Correct answer was '
2021

2122
if rand_num in prime_numbers:
2223
correct_answer = 'yes'
@@ -27,7 +28,7 @@ def prime():
2728
print('Correct!')
2829
count += 1
2930
else:
30-
print(f"{user_answer} is wrong answer ;(. Correct answer was {correct_answer}.")
31+
print(f"{user_answer} is wrong answer ;(. {cor_str}{correct_answer}.")
3132
return print(f"Let's try again, {name}!")
3233

3334
print(f'Congratulations, {name}!')

brain_games/games/brain_progression.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def progression():
1616
end = random.randint(40, 60)
1717
step = random.randint(2, 5)
1818
numbers = []
19+
cor_str = 'Correct answer was '
1920

2021
for current in range(start, end, step):
2122
numbers.append(current)
@@ -32,7 +33,7 @@ def progression():
3233
print('Correct!')
3334
count += 1
3435
else:
35-
print(f"{user_answer} is wrong answer ;(. Correct answer was {correct_answer}.")
36+
print(f"{user_answer} is wrong answer ;(. {cor_str}{correct_answer}.")
3637
return print(f"Let's try again, {name}!")
3738

3839
print(f'Congratulations, {name}!')

0 commit comments

Comments
 (0)