Skip to content

Commit a7717ab

Browse files
committed
add eigth step
1 parent 71590c5 commit a7717ab

File tree

8 files changed

+121
-77
lines changed

8 files changed

+121
-77
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@
1212

1313
### Asciinema gcd
1414
[![Demo](https://asciinema.org/a/3Nyh8N1i0CPdvK2vNJtHHjDXW)
15+
16+
### Asciinema progression
17+
[![Demo](https://asciinema.org/a/wWDvdSM2FQGVay1PpYbukSDEJ)
0 Bytes
Binary file not shown.
Binary file not shown.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from random import randint
2+
3+
instruction = "What number is missing in the progression?"
4+
5+
6+
def question_answer_progression():
7+
questions_answers_progression = []
8+
for i in range(1, 4):
9+
x = randint(6, 11)
10+
begin = randint(1, 40)
11+
step = randint(1, int((100 - begin) / x - 1))
12+
progression = (list(range(begin, 100, step)[:x]))
13+
i = randint(0, len(progression) - 1)
14+
right_answer = str(progression[i])
15+
progression[i] = '..'
16+
question = ''
17+
for item in progression:
18+
question = question + ' ' + str(item)
19+
questions_answers_progression.append([question, right_answer])
20+
return questions_answers_progression
735 Bytes
Binary file not shown.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env python3
2+
3+
def main():
4+
from brain_games.games import for_all_games, for_brain_progression
5+
name = for_all_games.welcome_user()
6+
instruction = for_brain_progression.instruction
7+
questions_answers_progression = \
8+
for_brain_progression.question_answer_progression()
9+
for_all_games.game_engine(instruction, questions_answers_progression, name)
10+
11+
12+
if __name__ == '__main__':
13+
main()

demo.cast

Lines changed: 84 additions & 77 deletions
Large diffs are not rendered by default.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ brain-games = "brain_games.scripts.brain_games:main"
2525
brain-even = "brain_games.scripts.brain_even:main"
2626
brain-calc = "brain_games.scripts.brain_calc:main"
2727
brain-gcd = "brain_games.scripts.brain_gcd:main"
28+
brain-progression = "brain_games.scripts.brain_progression:main"

0 commit comments

Comments
 (0)