File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ import math
2+ import secrets
3+
4+
5+ def generate_round () -> tuple [str , str ]:
6+ num1 = secrets .randbelow (50 ) + 1 # 1-50
7+ num2 = secrets .randbelow (50 ) + 1 # 1-50
8+
9+ guestion = f"{ num1 } { num2 } "
10+ correct_answer = str (math .gcd (num1 , num2 ))
11+
12+ return guestion , correct_answer
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+ from brain_games .engine import run_game
3+ from brain_games .games .gcd import generate_round
4+
5+ DESCRIPTION = 'Find the greatest common divisor of given numbers.'
6+
7+
8+ def main ():
9+ run_game (DESCRIPTION , generate_round )
10+
11+
12+ if __name__ == '__main__' :
13+ main ()
Original file line number Diff line number Diff line change @@ -24,3 +24,4 @@ dev = [
2424brain-games = " brain_games.scripts.brain_games:main"
2525brain-even = " brain_games.scripts.brain_even:main"
2626brain-calc = " brain_games.scripts.brain_calc:main"
27+ brain-gcd = " brain_games.scripts.brain_gcd:main"
You can’t perform that action at this time.
0 commit comments