File tree Expand file tree Collapse file tree 4 files changed +28
-2
lines changed Expand file tree Collapse file tree 4 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -19,5 +19,8 @@ brain-calc:
1919brain-gcd :
2020 uv run brain-gcd
2121
22+ brain-progresssion :
23+ uv run brain-progression
24+
2225lint :
2326 uv run ruff check brain_games
Original file line number Diff line number Diff line change 1+ import random
2+ rules = 'What number is missing in the progression?'
3+ def get_round ():
4+ start = random .randint (1 , 50 )
5+ step = random .randint (1 , 10 )
6+ lenght = random .randint (5 , 11 )
7+ progression = []
8+ progression = list (range (start , start + step * lenght , step ))
9+ hiden_index = random .randint (0 , lenght - 1 )
10+ correct_answer = str (progression [hiden_index ])
11+ progression [hiden_index ] = '..'
12+ progression_str = ' ' .join (map (str , progression ))
13+ question = f'Question: { progression_str } '
14+ return question , 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 import progression
4+ def main ():
5+ run_game (progression )
6+
7+ if __name__ == '__main__' :
8+ main ()
Original file line number Diff line number Diff line change 11[project ]
22name = " hexlet-code"
3- version = " 0.4 .0"
3+ version = " 0.5 .0"
44description = " Add your description here"
55readme = " README.md"
66requires-python = " >=3.10"
@@ -24,4 +24,5 @@ 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"
27+ brain-gcd = " brain_games.scripts.brain_gcd:main"
28+ brain-progression = " brain_games.scripts.brain_progression:main"
You can’t perform that action at this time.
0 commit comments