Skip to main content

Arrays

  • Chapter
  • First Online:
Python Challenges
  • 3355 Accesses

Abstract

Arrays are data structures that store values of the same data type in a contiguous memory area. Thus, arrays are more memory-optimal and perform better than lists but are not supported natively in Python. However, they are supported by the array and numpy modules. In the following, you will look at the processing of data with the help of additional modules and deepen it with the help of exercises.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 54.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 69.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    1Please remember to install numpy using the pip tool: pip install numpy (on Mac, use pip3 instead of pip).

  2. 2.

    In other languages, multidimensional arrays are often implemented as arrays of arrays and thus do not necessarily have to be rectangular. In Python, this is equally true for nested lists, but not for NumPy arrays, which are always rectangular.

  3. 3.

    While this is always true for NumPy array, this is not always given when simulating an array using nested lists.

  4. 4.

    Therefore, thorough testing and a good selection of test cases are recommended in both cases. How to achieve this is described in my book Der Weg zum Java-Profi [Ind20].

  5. 5.

    In job interviews, you should clarify this by asking a question.

  6. 6.

    Please note that this may vary from system to system.

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2022 The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Inden, M. (2022). Arrays. In: Python Challenges. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-7398-2_6

Download citation

Publish with us

Policies and ethics