Through Python, a dictionary or list is often used to store a sequential collection of elements. Suppose, for instance, that you need to read 50 numbers, compute their average, and then compare each number with the average to determine whether it is below or above the average. In order to do this (without the use of list), you would first declare 50 variables to store the 50 numbers. This means you would have to create 50 variables and repeatedly write almost the identical code 50 times. Writing a program this way is impractical. To overcome this issue, you can make use of a list to store all the 50 numbers and access them through a single list variable.
For your initial post, describe the difference between dictionary and list in Python and explain when each would be used. Provide an example of how each dictionary and list would be implemented within Python.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here