From 5d2262de64f8f224ddf15a7d9e26a6306ac65a85 Mon Sep 17 00:00:00 2001 From: Nader Idkeidek Date: Wed, 20 May 2026 15:28:52 +0300 Subject: [PATCH] Sort global variables into mutable and immutable 3rd Try --- app/main.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index f07695b9b..1669700b8 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, +}