Skip to content

Commit

Permalink
refactored main function calc_game for codeclimate complexitiy
Browse files Browse the repository at this point in the history
Signed-off-by: hikarikumo <[email protected]>
  • Loading branch information
hikarikumo committed Dec 17, 2023
1 parent 0621f08 commit bd080ad
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions brain_games/calc_game.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# -*- coding:utf-8 -*-
"""Calc games function to ask questions and verify the answers."""

import random
import prompt
from cli import greet_first, welcome_user


OPERATIONS = {
'summation': ('+', lambda x, y: x + y),
'subtraction': ('-', lambda x, y: x - y),
Expand Down Expand Up @@ -43,16 +41,13 @@ def user_fail_message(name):


def calc_game_logic(name):
counter = 1
while counter <= 3:
for counter in range(1,3):
operations = list(OPERATIONS.keys())
for operation in operations:
if not play_game(operation):
user_fail_message(name)
return
if counter == 3:
print(f'Congratulations, {name}!')
counter += 1
print(f'Congratulations, {name}!')


def main():
Expand Down

0 comments on commit bd080ad

Please sign in to comment.