While working on a project that requires storing a list of daily temperatures in a program, you choose to use a data structure that holds multiple temperature values in a single variable. You need to be able to access these values by referring to an index number. Which data structure should you use?
An array is the correct data structure for holding multiple data items of the same type, such as temperature values, and allowing them to be accessed by an index. This is why it is the appropriate choice for storing a list of daily temperatures in an organized way. A dictionary involves key-value pairs, not indexed items. A loop is not a data structure but a control structure for iteration. A string typically represents a sequence of characters, not structured data like numerical temperature values.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is an array and how does it work?
Open an interactive chat with Bash
What is the difference between an array and a dictionary?
Open an interactive chat with Bash
Why can't I use a string to store multiple temperature values?