![]() ![]() Remember, you can get information about any function by typing ? and hitting shift-enter, e.g. ➤ Try these out! Explore how each of the functions works. Sum(a) returns the sum of the elements of a,Ī.append(x) adds a new element at the end of the listw, containing the contents of x,Ī.insert(i, x) adds a new element containing x at location `a``, shifting later elements ‘backwards’ by one,Ī.remove(x) finds the first occurrence of x in the list and removes it,Ī.count(x) counts the number of occurrences of x in the list,Ī.index(x) returns the index of the first occurrence of x in the list,Ī.reverse() flips the order of elements in a list, andĪ.pop(i) removes and return the element at index i in the list (or if no argument is provided, the last element in the list). Min(a) returns the smallest element of a, A few of the more important ones are detailed below, where we suppose a is a list: Python provides a number of standard functions for working with lists. ![]() However, if you need to build a large list, this is a very inefficient way of doing it, and your program will probably end up being very slow. Partial Differential Equations of Groundwater FlowĪ = a += print ( a ) # Prints '' Lists A list is defined by using square brackets, and, and consists of some set of entries separated by commas, e.g. Introduction to the stripy/python wrapper for litho 1.0Ī quick look at the depth-age relationship for the seafloor. Lists, tuples and dictionaries are some of the tools that Python provides for doing this. Going deeper - examples from the Earth SciencesĬartopy and the Shuttle Radar Topography Map dataĮxample 1 - Triangulation of arbitrary points on the sphereĮxample 6 - Scattered Data and ‘Heat Maps’Įxample 9 - Constructing the Voronoi diagramĮxample 1 - Triangulation of arbitrary points Exercise 1 - Getting started with Jupyter and PythonĮxercise 5 - Lists, tuples and dictionariesĮxercise 14 - Structured Data in Python (Įxercise 17 - Fourier analysis and Milankovitch cyclesĮxercise 18 - Object-oriented programmingĮxercise N - Visualising sorting algorithms ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |