From 94d9afefefca1d960868c569fa95914cc2b2a803 Mon Sep 17 00:00:00 2001 From: Nader Idkeidek Date: Thu, 21 May 2026 13:01:43 +0300 Subject: [PATCH] Add sorting of variables by type 6th Change and Final lucky_number = 777 pi = 3.14 one_is_a_prime_number = False name = "Richard" my_favourite_films = [ "The Shawshank Redemption", "The Lord of the Rings: The Return of the King", "Pulp Fiction", "The Good, the Bad and the Ugly", "The Matrix", ] profile_info = ("michel", "michel@gmail.com", "12345678") marks = { "John": 4, "Sergio": 3, } collection_of_coins = {1, 2, 25} # Create dictionary sorted_variables = { "mutable": [], "immutable": [] } # Put variables into a list variables = [lucky_number, pi, one_is_a_prime_number, name, my_favourite_films, profile_info, marks, collection_of_coins] # Check each variable type for variable in variables: if type(value) in [list, dict, set, tuple]: sorted_variables["mutable"].append(variable) else: sorted_variables["immutable"].append(variable) print(sorted_variables) --- app/main.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index f07695b9b..41effc965 100644 --- a/app/main.py +++ b/app/main.py @@ -16,4 +16,20 @@ } collection_of_coins = {1, 2, 25} -# write your code here +# Create dictionary +sorted_variables = { + "mutable": [], + "immutable": [] +} + +# Put variables into a list +variables = [lucky_number, pi, one_is_a_prime_number, name, my_favourite_films, profile_info, marks, collection_of_coins] + +# Check each variable type +for variable in variables: + if type(value) in [list, dict, set, tuple]: + sorted_variables["mutable"].append(variable) + else: + sorted_variables["immutable"].append(variable) + +print(sorted_variables)