+ 1

What is the solution to module 7/test case#1?

I've been trying this for days and I don't know what the problem is: car = { 'brand':'BMW', 'year': 2018, 'color': 'red', 'mileage': 15000 } print(car['brand'])

16th Sep 2023, 1:27 PM
Leila July
Leila July - avatar
11 odpowiedzi
+ 1
Leila July It states to get input from the user and then output the correct key. This code will not work as is, you need to complete it! https://code.sololearn.com/c96KX67BN16r/?ref=app
16th Sep 2023, 1:59 PM
Keith
Keith - avatar
+ 4
Leila July , Due to some confusions I reposted the same code...now changed...👍
16th Sep 2023, 2:20 PM
Riya
Riya - avatar
+ 3
Leila July , Can you show us the code you tried?? To view...
16th Sep 2023, 1:29 PM
Riya
Riya - avatar
+ 2
Leila July , It is working no mistakes...I just copy pasted your code... Look into it...it is working, https://code.sololearn.com/cc819Zt6k3c4/?ref=app
16th Sep 2023, 1:40 PM
Riya
Riya - avatar
+ 2
Leila July , Now try this... instead hard-coding...try to give it as user input... https://code.sololearn.com/cpRWm8dQsZ0C/?ref=app
16th Sep 2023, 1:51 PM
Riya
Riya - avatar
+ 2
Welcome! I think Riya was trying to point you in the same direction too 👍
16th Sep 2023, 2:15 PM
Keith
Keith - avatar
+ 2
Ohh sorry I haven't seen that earlier Thank you so much Riya!
16th Sep 2023, 2:28 PM
Leila July
Leila July - avatar
+ 1
You should post your code attempt and the task so that others can help you debug it.
16th Sep 2023, 1:29 PM
Keith
Keith - avatar
+ 1
car = { 'brand':'BMW', 'year': 2018, 'color': 'red', 'mileage': 15000 } print(car['brand'])
16th Sep 2023, 1:34 PM
Leila July
Leila July - avatar
+ 1
Thank you so much Keith, it worked!
16th Sep 2023, 2:07 PM
Leila July
Leila July - avatar
0
The expected output is BMW
16th Sep 2023, 1:35 PM
Leila July
Leila July - avatar