From 9bf30d5fa3b389f1277bab4bbe48939e5ecfc612 Mon Sep 17 00:00:00 2001 From: Oleksii Churbanov Date: Mon, 16 Dec 2024 17:42:16 +0200 Subject: [PATCH] implement py-mutable-immutable --- app/main.py | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index f07695b9..9ef7336e 100644 --- a/app/main.py +++ b/app/main.py @@ -16,4 +16,32 @@ } collection_of_coins = {1, 2, 25} -# write your code here +sorted_variables = {} + + +def mutable_immutable(*args) -> dict: + mutable = [] + immutable = [] + for element in args: + if isinstance(element, (list, set, dict)): + mutable.append(element) + else: + immutable.append(element) + + sorted_variables["mutable"] = mutable + sorted_variables["immutable"] = immutable + + return sorted_variables + + +result = mutable_immutable( + lucky_number, + pi, + one_is_a_prime_number, + name, + my_favourite_films, + profile_info, + marks, + collection_of_coins, +) +print(result)