Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
For point = (3, 4), find point[0], len(point) and the sum of the two numbers by unpacking.
A tuple is read by position, and unpacked with x, y = point.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, compare your working with the solution.
point[0] is the first item: 3.len(point) is 2.x, y = point puts 3 in x and 4 in y. Then x + y is 7.Log in to join the discussion.
Loading…