Introduction to Programming using Python 1st Edition

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

Chapter 10 - Lists - Section 10.2 - List Basics - Check Point - MyProgrammingLab - Page 323: 10.2

Answer

1) 6 elements 2) 0 3) 5 4) lst[2] = 12 5) lst[-2] = 10

Work Step by Step

1) We should use function len() to get the number of elements in a lst, also we can calculate them by hand. Lst contains 6 elements. 2) In python list indices starts at 0. The first element of list is at index 0 3)Accordingly, the index of the last element in lst is 5 4) lst[2] is the third element in lst. lst[2] = 12 5) Index value of -2 gives the second last element. lst[-2] = 10
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.