From 5391a26cdb338eb2f33f6233c1b47336ce608a12 Mon Sep 17 00:00:00 2001 From: Nader Idkeidek Date: Wed, 20 May 2026 13:06:00 +0300 Subject: [PATCH] Add sorting function for mutable and immutable variables 2nd try WO VS --- app/main.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index f07695b9b..4285b578b 100644 --- a/app/main.py +++ b/app/main.py @@ -16,4 +16,28 @@ } collection_of_coins = {1, 2, 25} -# write your code here +mutable = [] +immutable = [] + +def sort_variables(): + for name, value in globals().items(): + if name.startswith("__") or name in ( + "mutable", + "immutable", + "sorted_variables", + "sort_variables", + ): + continue + + if isinstance(value, (list, dict, set, tuple)): + mutable.append(value) + else: + immutable.append(value) + + +sort_variables() + +sorted_variables = { + "mutable": mutable, + "immutable": immutable, +}