From 7afe15d12eaa769729cdda915ef636dd3a88ae9f Mon Sep 17 00:00:00 2001 From: Derevianko-Volodymyr Date: Sun, 29 Oct 2023 18:21:37 +0200 Subject: [PATCH 1/2] Solution --- app/main.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index f07695b9..0b276d35 100644 --- a/app/main.py +++ b/app/main.py @@ -16,4 +16,26 @@ } collection_of_coins = {1, 2, 25} -# write your code here + +def create_dictionary(*args) -> dict: + + sorted_variables: dict = {} + immu_list = [] + mu_list = [] + + for arg in args: + + if isinstance(arg, (list, set, dict)): + mu_list.append(arg) + sorted_variables["mutable"] = mu_list + else: + immu_list.append(arg) + sorted_variables["immutable"] = immu_list + + return sorted_variables + + +sorted_variables = create_dictionary(lucky_number, pi, + one_is_a_prime_number, name, + my_favourite_films, profile_info, + marks, collection_of_coins) From 1b1a9435b0a116d18d4bc530436e1565df055837 Mon Sep 17 00:00:00 2001 From: Derevianko-Volodymyr Date: Sun, 29 Oct 2023 19:38:24 +0200 Subject: [PATCH 2/2] Solution --- app/main.py | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/app/main.py b/app/main.py index 0b276d35..e284fadb 100644 --- a/app/main.py +++ b/app/main.py @@ -17,25 +17,7 @@ collection_of_coins = {1, 2, 25} -def create_dictionary(*args) -> dict: - - sorted_variables: dict = {} - immu_list = [] - mu_list = [] - - for arg in args: - - if isinstance(arg, (list, set, dict)): - mu_list.append(arg) - sorted_variables["mutable"] = mu_list - else: - immu_list.append(arg) - sorted_variables["immutable"] = immu_list - - return sorted_variables - - -sorted_variables = create_dictionary(lucky_number, pi, - one_is_a_prime_number, name, - my_favourite_films, profile_info, - marks, collection_of_coins) +sorted_variables = {"mutable": [my_favourite_films, marks, + collection_of_coins], + "immutable": [lucky_number, pi, one_is_a_prime_number, + name, profile_info]}