Skip to content

Commit f40bc47

Browse files
authored
Update homework after teacher
1 parent d5acb97 commit f40bc47

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

Python_part_2/homework.py

+4-16
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,14 @@
33

44
# Тестирование переключения темной темы на сайте в зависимости от времени
55
def test_dark_theme_by_time():
6-
76
current_time = time(hour=23)
8-
is_dark_theme = None
9-
10-
if 6 < current_time.hour >= 22:
11-
is_dark_theme = True
7+
is_dark_theme = 6 < current_time.hour >= 22
128

139
assert is_dark_theme is True
1410

1511

1612
# Тестирование переключения темной темы на сайте в зависимости от времени и выбора пользователя
1713
def test_dark_theme_by_time_and_user_choice():
18-
1914
current_time = time(hour=16)
2015
dark_theme_enabled_by_user = True
2116
is_dark_theme = None
@@ -30,7 +25,6 @@ def test_dark_theme_by_time_and_user_choice():
3025

3126

3227
def test_find_suitable_user():
33-
3428
users = [
3529
{"name": "Oleg", "age": 32},
3630
{"name": "Sergey", "age": 24},
@@ -64,15 +58,9 @@ def test_find_suitable_user():
6458

6559
# Функция, которая будет печатать читаемое имя переданной ей функции и значений аргументов.
6660
def print_func_names(func, *args):
67-
func_name = func.__name__
68-
arguments = list(args)
69-
70-
words = func_name.replace("_", " ").split() # open_browser -> ["open", "browser"]
71-
capitalized_words = [word.capitalize() for word in words] # ["open", "browser"] -> ["Open", "Browser"]
72-
result = ' '.join(capitalized_words) # "Open Browser"
73-
74-
args_result = ', '.join(arguments) # ["https://companyname.com/login", "Register"] -> "https://companyname.com/login, Register"
75-
result = f"{result} [{args_result}]"
61+
func_name = func.__name__.replace("_", " ").title() # open_browser => "open browser" => "Open Browser"
62+
args_result = ", ".join([*args]) # ["https://companyname.com/login", "Register"] => "https://companyname.com/login, Register"
63+
result = f"{func_name} [{args_result}]"
7664

7765
print(result)
7866
return result

0 commit comments

Comments
 (0)