From 247e96297f8892780e0a851ace6a2617a5f7d06f Mon Sep 17 00:00:00 2001 From: Illya Huda Date: Mon, 13 Nov 2023 17:41:21 +0200 Subject: [PATCH 1/2] Creating a dictionary --- app/main.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/app/main.py b/app/main.py index f07695b9..2802a72f 100644 --- a/app/main.py +++ b/app/main.py @@ -15,5 +15,24 @@ "Sergio": 3, } collection_of_coins = {1, 2, 25} - -# write your code here +# write code below this line +list_of_all_variable = [ + lucky_number, + pi, + one_is_a_prime_number, + name, + my_favourite_films, + profile_info, + marks, + collection_of_coins +] +sorted_variables = {} +mutable_variable_list = [] +immutable_variable_list = [] +for element in list_of_all_variable: + if isinstance(element, (int, str, bool, float, tuple)): + immutable_variable_list.append(element) + else: + mutable_variable_list.append(element) +sorted_variables["mutable"] = mutable_variable_list +sorted_variables["immutable"] = immutable_variable_list From 1a8bf08886e98910b0ef297bfca24c958dbd299f Mon Sep 17 00:00:00 2001 From: Illya Huda Date: Mon, 13 Nov 2023 19:06:30 +0200 Subject: [PATCH 2/2] Correction of comments --- app/main.py | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/app/main.py b/app/main.py index 2802a72f..45255794 100644 --- a/app/main.py +++ b/app/main.py @@ -16,23 +16,15 @@ } collection_of_coins = {1, 2, 25} # write code below this line -list_of_all_variable = [ - lucky_number, - pi, - one_is_a_prime_number, - name, - my_favourite_films, - profile_info, - marks, - collection_of_coins -] -sorted_variables = {} -mutable_variable_list = [] -immutable_variable_list = [] -for element in list_of_all_variable: - if isinstance(element, (int, str, bool, float, tuple)): - immutable_variable_list.append(element) - else: - mutable_variable_list.append(element) -sorted_variables["mutable"] = mutable_variable_list -sorted_variables["immutable"] = immutable_variable_list +sorted_variables = { + "mutable": [ + my_favourite_films, + marks, + collection_of_coins], + "immutable": [ + lucky_number, + pi, + one_is_a_prime_number, + name, + profile_info] +}