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

Update exercises_tuples.md #5

Open
wants to merge 1 commit 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
6 changes: 6 additions & 0 deletions planning/exercises_tuples.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]