Ask Question
14 January, 14:02

Give your own examples for how list and dictionary data structures could keep track of some common information you might need.

+3
Answers (1)
  1. 14 January, 14:30
    0
    List and dictionary data structures keep track some of our common information that we need in the following way.

    Explanation:

    Every programming language has provision for data structures. In the Python programming language, there are a total of 4 inbuilt data structures. These are namely list, tuple, dictionary, and set. Each of them is unique in its own right.

    List

    A data structure that stores an ordered collection of items in Python is called a list. In other words, a list holds a sequence of items. You need to put all the items, separated by commas, in square brackets to let Python know that a list has been specified. The general syntax of a list is: some_list = [item 1, item 2, item 3, ..., item n] After creating a list in Python, it is possible to search, add, and remove items from the list.

    Dictionary

    It stores data in the form of key-value pairs. The keys defined for a dictionary need to be unique. Though values in a dictionary can be mutable or immutable objects, only immutable objects are allowed for keys.

    A dictionary in Python is defined using key-value pairs, separated by commas, enclosed within curly braces. The key and value are separated using a colon. The general syntax of a dictionary is: some_dictionary = {key 1 : value 1, key 2 : value 2, key 3 : value 3, ..., key n : value n}
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Give your own examples for how list and dictionary data structures could keep track of some common information you might need. ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers