Question: My Discussion post was explaining keys and values: cars = {'Hyundai': 1, 'Honda': 1} print(cars) Output would be: {'Hyundai': 1, 'Honda': 1} The professor asked
My Discussion post was explaining keys and values:
cars = {'Hyundai': 1, 'Honda': 1} print(cars)
Output would be:
{'Hyundai': 1, 'Honda': 1}
The professor asked me the following question:
I wonder how you would declare a dictionary structure if you want to store data with some elements as STRING and other elements as INTEGER? Let's say that you want to add a new key, "Ferrari", but with the STRING value "Not yet" instead of a number. Can you have this mix of data types in a dictionary? If yes, how?
I have been researching and need some guidance! Thanks in advance.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
