From 38ea8068cf5b59a2b26fb40b7daa374e7a8ad2c5 Mon Sep 17 00:00:00 2001 From: Trulsson <72693031+Trulsson@users.noreply.github.com> Date: Tue, 13 Oct 2020 09:56:19 +0200 Subject: [PATCH] Update exercises_tuples.md --- planning/exercises_tuples.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/planning/exercises_tuples.md b/planning/exercises_tuples.md index 448dddb..254058d 100644 --- a/planning/exercises_tuples.md +++ b/planning/exercises_tuples.md @@ -5,3 +5,9 @@ Make a `a_tuple = ("Paris", [1, 2, 3], (10, 20, 30, 40, 50))`. - What is the sum of all the items from the tuple element of `a_tuple`. - Unpack `a_tuple` in `3` variables: `city`, `a_list`, `another_tuple`. - Copy elements `30` and `40` from `another_tuple` into `third_tuple`. + +a_tuple = ("Paris", [1, 2, 3], (10, 20, 30, 40, 50)) +print(a_tuple[2][2]) +print(sum(list(a_tuple[2]))) +(city, a_list, another_tuple) = a_tuple +third_tuple=another_tuple[2:4]