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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started