+ 3

[solved] Course Python Developer Practice Dictionaries

Could the Practice be bugged? I cant seem to end it or i completely dont get, what the practice wants me to do. This is my code, and If i print them one by one it seems to be right, but i always seem to cant end the practice if i print them all at once: car = { 'brand':'BMW', 'year': 2018, 'color': 'red', 'mileage': 15000 } print(car['brand']) print(car['year']) print(car['color']) print(car['mileage']) Can someone help me out here?

11th Feb 2024, 10:12 PM
Daniel Tuttaß
6 Antworten
+ 7
Read the task instructions carefully. You're supposed to take INPUT. The input is a key of the dictionary.
11th Feb 2024, 10:50 PM
Lisa
Lisa - avatar
+ 4
Daniel Tuttaß You should have one conclusion, not four. Carefully re-read the assignment, it explains everything.
11th Feb 2024, 11:28 PM
Solo
Solo - avatar
+ 2
Thank you for your answers! It helped a lot already, but i needed to google a bit more, to understand, what this exercise wanted me to do here. Its rather simple, but to this point you only had one lesson in dictionaries and taking input as a key was not part of that lesson, thats why i was so confused with this.
12th Feb 2024, 2:56 PM
Daniel Tuttaß
+ 1
Daniel Tuttaß , Can is see your latest code if it still doesn't work? Also, can you paste the directions? I forget if that one requires you to print "Not found" or something too. Using input as a key might be as simple as print(car[input()]) unless you also need to do "Not found" sometimes.
14th Feb 2024, 1:19 AM
Rain
Rain - avatar
+ 1
Daniel Tuttaß , Haha. Awesome. Will you add [Solved] to the title?
14th Feb 2024, 6:48 AM
Rain
Rain - avatar
0
Rain "Not found" wasnt needed, it worked for me with just key= input() print(car[key])
14th Feb 2024, 6:47 AM
Daniel Tuttaß