Skip to content

Commit

Permalink
refac logic in games/ files: move congratulations message to end of file
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaly Chasovskikh committed Apr 5, 2024
1 parent d32e4d7 commit 4752528
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 10 deletions.
3 changes: 1 addition & 2 deletions brain_games/games/calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ def calculation():
if chek:
print("Correct!")
counter += 1
if counter == NUMBER_OF_ROUNDS:
print(f"Congratulations, {name}!")
else:
lost_message = (
f"'{answer}' is wrong answer ;(. "
Expand All @@ -31,3 +29,4 @@ def calculation():
print(lost_message)
print(f"Let's try again, {name}!")
break
print(f"Congratulations, {name}!")
3 changes: 1 addition & 2 deletions brain_games/games/even.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ def is_number_even():
if chek:
print("Correct!")
counter += 1
if counter == NUMBER_OF_ROUNDS:
print(f"Congratulations, {name}!")
else:
lost_message = (
f"'{answer}' is wrong answer ;(. "
Expand All @@ -31,3 +29,4 @@ def is_number_even():
print(lost_message)
print(f"Let's try again, {name}!")
break
print(f"Congratulations, {name}!")
3 changes: 1 addition & 2 deletions brain_games/games/gcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ def gcd():
if chek:
print("Correct!")
counter += 1
if counter == NUMBER_OF_ROUNDS:
print(f"Congratulations, {name}!")
else:
lost_message = (
f"'{answer}' is wrong answer ;(. "
Expand All @@ -31,3 +29,4 @@ def gcd():
print(lost_message)
print(f"Let's try again, {name}!")
break
print(f"Congratulations, {name}!")
3 changes: 1 addition & 2 deletions brain_games/games/prime.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ def prime():
if chek:
print("Correct!")
counter += 1
if counter == NUMBER_OF_ROUNDS:
print(f"Congratulations, {name}!")
else:
lost_message = (
f"'{answer}' is wrong answer ;(. "
Expand All @@ -31,3 +29,4 @@ def prime():
print(lost_message)
print(f"Let's try again, {name}!")
break
print(f"Congratulations, {name}!")
3 changes: 1 addition & 2 deletions brain_games/games/progression.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ def progression():
if chek:
print("Correct!")
counter += 1
if counter == NUMBER_OF_ROUNDS:
print(f"Congratulations, {name}!")
else:
lost_message = (
f"'{answer}' is wrong answer ;(. "
Expand All @@ -31,3 +29,4 @@ def progression():
print(lost_message)
print(f"Let's try again, {name}!")
break
print(f"Congratulations, {name}!")

0 comments on commit 4752528

Please sign in to comment.