+ 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?
6 odpowiedzi
+ 7
Read the task instructions carefully.
You're supposed to take INPUT. The input is a key of the dictionary.
+ 4
Daniel Tuttaß You should have one conclusion, not four. Carefully re-read the assignment, it explains everything.
+ 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.
+ 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.
+ 1
Daniel Tuttaß ,
Haha. Awesome. Will you add [Solved] to the title?
0
Rain "Not found" wasnt needed, it worked for me with just
key= input()
print(car[key])