Python 3: Sequences
This intermediate-level resource for those learning to program with Python 3.x looks at lists (called arrays in other languages), strings and tuples. It covers the main features of these sequences, including the differences between them, how the elements of each are referenced, and some of the functions and calculations that can be applied to them.
Tutorial sections are also included on:
• how to convert lists to tuples (and vice versa)
• how to ‘unpack’ them
• locating elements in list with positive and negative indices
• slicing lists
• ranges as sequences
• modifying lists with a range of functions (tuples cannot be modified)
• working with lists of lists
• defining constants and using them in triangular lists
Each section contains a short set of exercises – these can be carried out using a Python interpreter or can be set as a ‘computational thinking’ mental challenge. A summary of the available operations for lists, and for all sequences, is found at the end of the document.
Show health and safety information
|Published||2010 to 2019|
|Log in to rate this resource|
- School Coders