diff --git a/app/main.py b/app/main.py index f07695b9b..1f0d5129b 100644 --- a/app/main.py +++ b/app/main.py @@ -1,7 +1,19 @@ +# mutable variable - list, dictionary, set +# immutable variable - int, float, bool, string, tuple + +# int lucky_number = 777 + +# float pi = 3.14 + +# bool one_is_a_prime_number = False + +# string name = "Richard" + +# list my_favourite_films = [ "The Shawshank Redemption", "The Lord of the Rings: The Return of the King", @@ -9,11 +21,35 @@ "The Good, the Bad and the Ugly", "The Matrix", ] + +# tuple profile_info = ("michel", "michel@gmail.com", "12345678") + +# dictionary marks = { "John": 4, "Sergio": 3, } + +# set collection_of_coins = {1, 2, 25} -# write your code here +variables = [ + lucky_number, + pi, + one_is_a_prime_number, + name, + my_favourite_films, + profile_info, + marks, + collection_of_coins, +] +mutable = [] +immutable = [] + +mutable_types = (list, dict, set) + +mutable = [var for var in variables if isinstance(var, mutable_types)] +immutable = [var for var in variables if not isinstance(var, mutable_types)] + +sorted_variables = {"mutable": mutable, "immutable": immutable}