Skip to content

Commit

Permalink
'Solution'
Browse files Browse the repository at this point in the history
  • Loading branch information
Bogdannna7 committed Dec 8, 2024
1 parent e67b5ea commit 74045c5
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,30 @@
}
collection_of_coins = {1, 2, 25}

# write your code here
def sorted_variables_func(*args):
types = {"mutable" : ["list", "dict", "set"],
"immutable" : ["int", "float", "str", "bool", "tuple"]}

variables_dict = {key : value for key, value in globals().items()
if not key.startswith("__")}

mutable = []
immutable = []

for arg in args:
var_name = [key for key, value in variables_dict.items()
if value is arg]
if var_name:
var_name = var_name[0]
if type(arg).__name__ in types["mutable"]:
mutable.append(arg)
elif type(arg).__name__ in types["immutable"]:
immutable.append(arg)

return {"mutable" : mutable, "immutable" : immutable}


sorted_variables = sorted_variables_func(lucky_number, pi,
one_is_a_prime_number, name,
my_favourite_films, profile_info,
marks, collection_of_coins)

0 comments on commit 74045c5

Please sign in to comment.