diff --git a/Fork_code b/Fork_code new file mode 100644 index 000000000..3e7a80b02 --- /dev/null +++ b/Fork_code @@ -0,0 +1,32 @@ +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} + +sorted_variables = { + "mutable": [ + my_favourite_films, + marks, + collection_of_coins, + ], + "immutable": [ + lucky_number, + pi, + one_is_a_prime_number, + name, + profile_info, + ], +} diff --git a/app/main.py b/app/main.py index f07695b9b..3e7a80b02 100644 --- a/app/main.py +++ b/app/main.py @@ -16,4 +16,17 @@ } collection_of_coins = {1, 2, 25} -# write your code here +sorted_variables = { + "mutable": [ + my_favourite_films, + marks, + collection_of_coins, + ], + "immutable": [ + lucky_number, + pi, + one_is_a_prime_number, + name, + profile_info, + ], +} diff --git a/fork_code b/fork_code new file mode 100644 index 000000000..e0c1d3f5a --- /dev/null +++ b/fork_code @@ -0,0 +1,13 @@ +sorted_variables = { + "mutable": [], + "immutable": [], +} + +for name, value in globals().items(): + if name.startswith("__") or name == "sorted_variables": + continue + + if isinstance(value, (list, dict, set)): + sorted_variables["mutable"].append(value) + else: + sorted_variables["immutable"].append(value)