Skip to content

Commit 161b564

Browse files
committed
linter fixes blank lines
1 parent eabccf3 commit 161b564

File tree

9 files changed

+27
-4
lines changed

9 files changed

+27
-4
lines changed

brain_games/engine.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ def welcome_user():
66
print(f"Hello, {name}!")
77
return name
88

9+
910
def ask_question(question):
1011
print(f"Question: {question}")
1112
return input("Your answer: ")
1213

14+
1315
def check_answer(user_answer, correct_answer, name):
1416
if user_answer == correct_answer:
1517
print("Correct!")
@@ -19,6 +21,7 @@ def check_answer(user_answer, correct_answer, name):
1921
print(f"Let's try again, {name}!")
2022
return False
2123

24+
2225
def run_game(game_logic):
2326
name = welcome_user()
2427
print(game_logic['instructions'])

brain_games/scripts/brain_calc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import random
22

3+
34
def get_random_expression():
45
operations = ['+', '-', '*']
56
num1 = random.randint(1, 100)
@@ -8,6 +9,7 @@ def get_random_expression():
89
expression = f"{num1} {operation} {num2}"
910
return expression, eval(expression)
1011

12+
1113
def main():
1214
print('Welcome to the Brain Games!')
1315
name = input('May I have your name? ')
@@ -29,5 +31,6 @@ def main():
2931

3032
print(f'Congratulations, {name}!')
3133

34+
3235
if __name__ == '__main__':
3336
main()

brain_games/scripts/brain_even.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import random
22

3+
34
def main():
45
print('Welcome to the Brain Games!')
56
name = input('May I have your name? ')
@@ -23,6 +24,7 @@ def main():
2324
return # Завершение игры при неправильном ответе
2425

2526
print(f"Congratulations, {name}!") # Поздравление при успешной игре
27+
2628

2729
if __name__ == '__main__':
2830
main()

brain_games/scripts/brain_games.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
from brain_games.cli import welcome_user
22

3+
34
def main():
45

56
welcome_user()
67

8+
79
if __name__ == '__main__':
810

911
main()

brain_games/scripts/brain_gcd.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,21 @@
22
import math
33
from brain_games.engine import run_game
44

5+
56
def get_question_and_answer():
67
number1 = random.randint(1, 100) # Генерация первого случайного числа
78
number2 = random.randint(1, 100) # Генерация второго случайного числа
89
correct_answer = str(math.gcd(number1, number2))
910
return f"{number1} {number2}", correct_answer
1011

12+
1113
def main():
1214
game_logic = {
1315
'instructions': 'Find the greatest common divisor of given numbers.',
1416
'get_question_and_answer': get_question_and_answer
1517
}
1618
run_game(game_logic)
1719

20+
1821
if __name__ == '__main__':
1922
main()

brain_games/scripts/brain_prime.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import random
22
from brain_games.engine import run_game
33

4+
45
def is_prime(n):
56
##Проверяет, является ли число простым
67
if n < 2:
@@ -10,20 +11,24 @@ def is_prime(n):
1011
return False
1112
return True
1213

14+
1315
def generate_question():
1416
##Создает вопрос и правильный ответ
1517
number = random.randint(1, 100) ## Генерация случайного числа от 1 до 100
1618
correct_answer = 'yes' if is_prime(number) else 'no'
1719
return str(number), correct_answer
1820

21+
1922
def game_logic():
2023
return {
2124
'instructions': 'Answer "yes" if given number is prime. Otherwise answer "no".',
2225
'get_question_and_answer': generate_question
2326
}
2427

28+
2529
def main():
2630
run_game(game_logic())
2731

32+
2833
if __name__ == "__main__":
2934
main()
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,32 @@
11
import random
22
from brain_games.engine import run_game
33

4+
45
def generate_progression():
56
length = random.randint(5, 10) # Генерация длины прогрессии от 5 до 10
67
start = random.randint(1, 20) # Начальное число
78
step = random.randint(1, 5) # Шаг прогрессии
89
progression = [start + i * step for i in range(length)]
9-
10-
hidden_index = random.randint(0, length - 1) # Случайно выбираем позицию для замены
10+
11+
# Случайно выбираем позицию для замены
12+
hidden_index = random.randint(0, length - 1)
1113
hidden_value = progression[hidden_index]
12-
14+
1315
progression[hidden_index] = '..' # Заменяем скрытое значение на '..'
14-
16+
1517
return ' '.join(map(str, progression)), str(hidden_value)
1618

19+
1720
def game_logic():
1821
return {
1922
'instructions': "What number is missing in the progression?",
2023
'get_question_and_answer': generate_progression
2124
}
2225

26+
2327
def main():
2428
run_game(game_logic())
2529

30+
2631
if __name__ == "__main__":
2732
main()
57 Bytes
Binary file not shown.

dist/hexlet_code-0.1.0.tar.gz

621 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)