Two-dimensional list example: Driving distance between cities. The following example illustrates the use of a two-dimensional list
Fantastic news! We've Found the answer you've been seeking!
Question:
Two-dimensional list example: Driving distance between cities.
The following example illustrates the use of a two-dimensional list in a distance between cities example.
Run the following program, entering the text '1 2' as input to find the distance between LA and Chicago. Try other pairs. Next, try modifying the program by adding a new city, Anchorage, that is 3400, 3571, and 4551 miles from Los Angeles, Chicago, and Boston, respectively.
Note that the styling of the nested list in this example makes use of indentation to clearly indicate the elements of each list -- the spacing does not affect how the interpreter evaluates the list contents.
Related Book For
Research Methods for Business A Skill Building Approach
ISBN: 978-1119942252
6th edition
Authors: Uma Sekaran, Roger Bougie
Posted Date: