From ab8b0f0b7e682485e7973eb0a8d0b9a098022b99 Mon Sep 17 00:00:00 2001 From: Slavtvin Date: Sun, 14 Jun 2026 18:11:02 +0300 Subject: [PATCH 1/3] Create dict mutable and immutable, add type --- app/main.py | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index f07695b9b..f68a167a0 100644 --- a/app/main.py +++ b/app/main.py @@ -16,4 +16,46 @@ } collection_of_coins = {1, 2, 25} -# write your code here +sorted_variables = {"mutable": [], "immutable": [] } + +if type(lucky_number) == int: + sorted_variables["immutable"].append(lucky_number) +else: + sorted_variables["mutable"].append(lucky_number) + +if type(pi) ==float: + sorted_variables["immutable"].append(pi) +else: + sorted_variables["mutable"].append(pi) + +if type(one_is_a_prime_number) == bool: + sorted_variables["immutable"].append(one_is_a_prime_number) +else: + sorted_variables["mutable"].append(one_is_a_prime_number) + +if type(name) == str: + sorted_variables["immutable"].append(name) +else: + sorted_variables["mutable"].append(name) + +if type(my_favourite_films) ==list: + sorted_variables["mutable"].append(my_favourite_films) +else: + sorted_variables["immutable"].append(my_favourite_films) + +if type(profile_info) == tuple: + sorted_variables["immutable"].append(profile_info) +else: + sorted_variables["mutable"].append(profile_info) + +if type(marks) == dict: + sorted_variables["mutable"].append(marks) +else: + sorted_variables["immutable"].append(marks) + +if type(collection_of_coins) == set: + sorted_variables["mutable"].append(collection_of_coins) +else: + sorted_variables["immutable"].append(collection_of_coins) + +print(sorted_variables) \ No newline at end of file From d4d80f550f739b74aa12b54655a069ca45f2ec9c Mon Sep 17 00:00:00 2001 From: Slavtvin Date: Sun, 14 Jun 2026 18:20:28 +0300 Subject: [PATCH 2/3] Create dict mutable and immutable, add type(2) --- app/main.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/main.py b/app/main.py index f68a167a0..9c223c13a 100644 --- a/app/main.py +++ b/app/main.py @@ -16,14 +16,14 @@ } collection_of_coins = {1, 2, 25} -sorted_variables = {"mutable": [], "immutable": [] } +sorted_variables = {"mutable": [], "immutable": []} if type(lucky_number) == int: sorted_variables["immutable"].append(lucky_number) else: sorted_variables["mutable"].append(lucky_number) -if type(pi) ==float: +if type(pi) == float: sorted_variables["immutable"].append(pi) else: sorted_variables["mutable"].append(pi) @@ -38,7 +38,7 @@ else: sorted_variables["mutable"].append(name) -if type(my_favourite_films) ==list: +if type(my_favourite_films) == list: sorted_variables["mutable"].append(my_favourite_films) else: sorted_variables["immutable"].append(my_favourite_films) @@ -57,5 +57,3 @@ sorted_variables["mutable"].append(collection_of_coins) else: sorted_variables["immutable"].append(collection_of_coins) - -print(sorted_variables) \ No newline at end of file From 3ed612f7c9031c35601185f7d0393e5598f89d4c Mon Sep 17 00:00:00 2001 From: Slavtvin Date: Sun, 14 Jun 2026 18:33:20 +0300 Subject: [PATCH 3/3] Create dict mutable and immutable, add type(3) --- app/main.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/main.py b/app/main.py index 9c223c13a..f607aea27 100644 --- a/app/main.py +++ b/app/main.py @@ -18,42 +18,42 @@ sorted_variables = {"mutable": [], "immutable": []} -if type(lucky_number) == int: +if isinstance(lucky_number, int): sorted_variables["immutable"].append(lucky_number) else: sorted_variables["mutable"].append(lucky_number) -if type(pi) == float: +if isinstance(pi, float): sorted_variables["immutable"].append(pi) else: sorted_variables["mutable"].append(pi) -if type(one_is_a_prime_number) == bool: +if isinstance(one_is_a_prime_number, bool): sorted_variables["immutable"].append(one_is_a_prime_number) else: sorted_variables["mutable"].append(one_is_a_prime_number) -if type(name) == str: +if isinstance(name, str): sorted_variables["immutable"].append(name) else: sorted_variables["mutable"].append(name) -if type(my_favourite_films) == list: +if isinstance(my_favourite_films, list): sorted_variables["mutable"].append(my_favourite_films) else: sorted_variables["immutable"].append(my_favourite_films) -if type(profile_info) == tuple: +if isinstance(profile_info, tuple): sorted_variables["immutable"].append(profile_info) else: sorted_variables["mutable"].append(profile_info) -if type(marks) == dict: +if isinstance(marks, dict): sorted_variables["mutable"].append(marks) else: sorted_variables["immutable"].append(marks) -if type(collection_of_coins) == set: +if isinstance(collection_of_coins, set): sorted_variables["mutable"].append(collection_of_coins) else: sorted_variables["immutable"].append(collection_of_coins)