Introduction to Programming using Python 1st Edition

Published by Pearson
ISBN 10: 0132747189
ISBN 13: 978-0-13274-718-9

Chapter 14 - Tuples, Sets, and Dictionaries - Section 14.2 - Tuples - Check Point - MyProgrammingLab - Page 478: 14.4

Answer

(1, 2, 3, 7, 9, 0, 5) 1 (2, 3) 5 (1, 2, 3, 7, 9, 0) (2, 3, 7, 9, 0)

Work Step by Step

1) print(t) => Prints out tuple = (1, 2, 3, 7, 9, 0, 5) 2) print(t[0]) => Prints the first element of tuple = 1 3) print(t[1: 3]) => Prints elements from index 1 to 2 = (2, 3) 4) print(t[-1]) => Prints the last element of tuple = 5 5) print(t[ : -1]) => Prints elements from index 0 to 6 = (1, 2, 3, 7, 9, 0) 6) print(t[1 : -1]) => Prints elements from index 1 to 6 = (2, 3, 7, 9, 0)
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.