Skip to content

Commit 2aa3619

Browse files
committed
Update files brain_even.py brain_games.py
1 parent 4fd1b80 commit 2aa3619

File tree

3 files changed

+1
-38
lines changed

3 files changed

+1
-38
lines changed

brain_games/module.py

Lines changed: 0 additions & 2 deletions
This file was deleted.

brain_games/scripts/brain_even.py

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,4 @@
1-
import prompt
2-
import random
3-
4-
5-
MIN_NUM, MAX_NUM = 1, 150
6-
7-
8-
def is_even(num):
9-
return num % 2 == 0
10-
11-
12-
def run_even_game():
13-
print('Welcome to the Brain Games!')
14-
name = prompt.string('May I have your name? ')
15-
print(f'Hello, {name}')
16-
print('Answer "yes" if the number is even, otherwise answer "no".')
17-
18-
count_tries = 0
19-
20-
while count_tries < 3:
21-
num = random.randint(MIN_NUM, MAX_NUM)
22-
correct_answer = 'yes' if is_even(num) else 'no'
23-
print(f'Question: {num}')
24-
answer = prompt.string('Your answer: ')
25-
26-
if answer == correct_answer:
27-
print('Correct!')
28-
count_tries += 1
29-
else:
30-
print(f"'{answer}' is wrong answer ;(. Correct answer was '{correct_answer}'."
31-
f"Let's try again, {name}!")
32-
count_tries = 0
33-
34-
print(f'Congratulations, {name}!')
1+
from brain_games.games.even import run_even_game
352

363

374
def main():

brain_games/scripts/brain_games.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
# from brain_games.module import greet
21
from brain_games.cli import welcome_user
32

43

54
def main():
6-
# greet()
75
welcome_user()
86

97

0 commit comments

Comments
 (0)