0
python introduction course dictionary practice (collection types)
you are working at a car dealership and store the car data in a dictionary: car = { 'brand': 'BMW', 'year': 2018, 'color': 'red' } Your program needs to take the key as input and output the corresponding value. Sample Input year Sample Output 2018 So i wrote print(ages["year") and I got only 1 of the 4 test cases correct so I was wondering how do I answer this question? I even tried using the ai they have but i can't access it and i cant see the other answers for the test cases either because I don't have the pro version unlocked - if anyone can help It would be very much appreciated
2 Answers
+ 1
There are two notes /
1 - You should take the key from the user as an input.
2 - You should save this input into a variable and access it (because the user might input 'brand' or 'year' or 'color')
0
Double check the name of the dictionary you're calling on