I need help with this. It’s for a discussion board. Create a scenario that incor
ID: 3591309 • Letter: I
Question
I need help with this. It’s for a discussion board. Create a scenario that incorporates data that would use lists or dictionaries. Explain why a list or dictionary would be more appropriate for this scenario. Be sure to provide details and examples. I need help with this. It’s for a discussion board. Create a scenario that incorporates data that would use lists or dictionaries. Explain why a list or dictionary would be more appropriate for this scenario. Be sure to provide details and examples. Create a scenario that incorporates data that would use lists or dictionaries. Explain why a list or dictionary would be more appropriate for this scenario. Be sure to provide details and examples.Explanation / Answer
Let us discuss List and Dictionaries:
List: list is having a name and defined by keeping the items in the list and the items in the list are enclosed with square brackets [].
for example :
class = ['first','second','third']
number = [ 1,2,45,789 ]
list not only contains a particular datatype.thatmeans it can also contain different types of data that is the list can contain integer type data as well as string data.
for example:
s = [ 'sudha',1,'bhaskar',7];
we can add or remove the lists if recquired.
we can use list in iteration also.
Dictionaries are also used for data organization similar to list.
similar to list the dictionary also contains the names and are enclosed with curly braces.
data in the dictinary is stored with key value pairs.
here the key defines the items in the dictionary.
the value defines the number
for example: fr = {'apple' : 200, 'grapes' : 25, 'mango' : 15, 'custered-apple' : 2}
we can add and remove the information using dictionaries.
its usage is widly spread in the areas of gaming,web applications etc..