Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ((1, 1), (2, 2), (12, 13), (4, 4), (99, 98))
- multuple = ((1, 1), (2, 2), (12, 13), (4, 4), (99, 98))
- for a, b in multuple:
- print("{} = {} x {}".format(a*b,a,b)
- >>> data = ((1, 1), (2, 2), (12, 13), (4, 4), (99, 98))
- >>> result = (a[0] * a[1] for a in data)
- >>> list(result)
- [1, 4, 156, 16, 9702]
- >>>
- result = []
- for item in data:
- result.append(item[0] * item[1])
- >>> data = ((1, 1), (2, 2), (12, 13), (4, 4), (99, 98))
- >>> result = (a[0] * a[1] for a in data)
- >>> for item in zip(data, list(result)):
- print 'Product of {} and {} is {}'.format(item[0][0], item[0][3], item[1])
- Product of 1 and 1 is 1
- Product of 2 and 2 is 4
- Product of 12 and 13 is 156
- Product of 4 and 4 is 16
- Product of 99 and 98 is 9702
- >>>
- >>> ((1, 1), (2, 2), (12, 13), (4, 4), (99, 98))
- >>> [n*m for n, m in start]
- [1, 4, 156, 16, 9702]
- >>> data = ((1, 1), (2, 2), (12, 13), (4, 4), (99, 98))
- >>> for x, y in data:
- >>> print("{} * {} = {}".format(x, y, x*y))
- 1 * 1 = 1
- 2 * 2 = 4
- 12 * 13 = 156
- 4 * 4 = 16
- 99 * 98 = 9702
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement