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

implement py-mutable-immutable #2021

Open
wants to merge 3 commits 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
32 changes: 31 additions & 1 deletion app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,34 @@
}
collection_of_coins = {1, 2, 25}

# write your code here
sorted_variables = {}
AlexCyberf marked this conversation as resolved.
Show resolved Hide resolved


def mutable_immutable(*args) -> dict:
global sorted_variables
sorted_variables = {"mutable": [], "immutable": []}
mutable = []
immutable = []
for element in args:
if isinstance(element, (list, set, dict)):
mutable.append(element)
else:
immutable.append(element)

sorted_variables["mutable"] = mutable
sorted_variables["immutable"] = immutable
AlexCyberf marked this conversation as resolved.
Show resolved Hide resolved

return sorted_variables


result = mutable_immutable(
lucky_number,
pi,
one_is_a_prime_number,
name,
my_favourite_films,
profile_info,
marks,
collection_of_coins,
)
print(result)
Loading