Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution #2025

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,35 @@
}
collection_of_coins = {1, 2, 25}

# write your code here
sorted_variables = {
"mutable": [],
"immutable": []
}

variables = {
"lucky_number": lucky_number,
"pi": pi,
"one_is_a_prime_number": one_is_a_prime_number,
"name": name,
"profile_info": profile_info,
"my_favourite_films": my_favourite_films,
"marks": marks,
"collection_of_coins": collection_of_coins,
}

mutable_types = (list, dict, set)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mutable_types tuple should include set instead of frozenset, as set is mutable and frozenset is immutable. Ensure that the correct types are used for classification.


for var_name, var_value in variables.items():
if isinstance(var_value, mutable_types):
sorted_variables["mutable"].append(var_value)
else:
sorted_variables["immutable"].append(var_value)

print("Sorted Variables Dictionary:")
print("Mutable Variables:")
for var in sorted_variables["mutable"]:
print(var)

print("\nImmutable Variables:")
for var in sorted_variables["immutable"]:
print(var)
Loading