File tree Expand file tree Collapse file tree 5 files changed +34
-2
lines changed Expand file tree Collapse file tree 5 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -21,3 +21,6 @@ The first project on [Hexlet](https://ru.hexlet.io/professions/python/projects/4
2121
2222[ ![ asciicast] ( https://asciinema.org/a/kSeWIg1XFAvI37egtMgaKHNqK.svg )] ( https://asciinema.org/a/kSeWIg1XFAvI37egtMgaKHNqK )
2323
24+ ### THE FIFTH GAME: brain-prime
25+
26+ [ ![ asciicast] ( https://asciinema.org/a/zIBoTjFRs9zhiKysSPEI6u2ya.svg )] ( https://asciinema.org/a/zIBoTjFRs9zhiKysSPEI6u2ya )
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ def game_start(game):
1515 answer = get_answer (question )
1616
1717 if answer != correct :
18- print (f"{ answer } is wrong answer ;(. Correct answer was { correct } ."
18+ print (f"' { answer } ' is wrong answer ;(. Correct answer was ' { correct } ' ."
1919 f"\n Let's try again, { player } !" )
2020 return
2121 print ('Correct' )
Original file line number Diff line number Diff line change 1+ from random import randint
2+
3+ RULES = 'Answer "yes" if given number is prime. Otherwise answer "no".'
4+
5+ def start_game ():
6+ num = randint (1 , 100 )
7+ total = 0
8+ for i in range (1 , num + 1 ):
9+ if num % i == 0 :
10+ total += 1
11+
12+ question = f'{ num } '
13+ if total <= 2 :
14+ answaer = 'yes'
15+ else :
16+ answaer = 'no'
17+
18+ return (question , answaer )
Original file line number Diff line number Diff line change 1+ from brain_games .game_skeleton import game_start
2+ from brain_games .games import prime
3+
4+
5+ def main ():
6+ game_start (prime )
7+
8+
9+ if __name__ == "__main__" :
10+ main ()
Original file line number Diff line number Diff line change @@ -25,4 +25,5 @@ brain-games = "brain_games.scripts.brain_games:main"
2525brain-even = " brain_games.scripts.brain_even:main"
2626brain-calc = " brain_games.scripts.brain_calc:main"
2727brain-gcd = " brain_games.scripts.brain_gcd:main"
28- brain-progression = " brain_games.scripts.brain_progression:main"
28+ brain-progression = " brain_games.scripts.brain_progression:main"
29+ brain-prime = " brain_games.scripts.brain_prime:main"
You can’t perform that action at this time.
0 commit comments