+ 2

Please guys help me with this... DICTIONARY FUNCTIONS, under PYTHON INTERMIDATE

data = { 'Singapore': 1, 'Ireland': 6, 'United Kingdom': 7, 'Germany': 27, 'Armenia': 34, 'United States': 17, 'Canada': 9, 'Italy': 74 } pick= input() print(data.get(pick, "Not Found")) #did "Not found" as well

12th Jan 2024, 2:09 PM
CHRISTIAN
CHRISTIAN - avatar
8 Réponses
+ 3
CHRISTIAN , Notice Lothar used lowercase f in found. What I usually do is copy the return strings from the description and paste them into my code. Rewriting them by hand only creates opportunity for error. It's good practice for when a client gives you text they want you to use in the program you're writing for them. If you copy and paste, and the text is bad, your ass is covered, because you used what they gave you. Heh.
12th Jan 2024, 5:57 PM
Rain
Rain - avatar
+ 5
CHRISTIAN , the text output (if key will not be found) should be "Not found" ^
12th Jan 2024, 5:30 PM
Lothar
Lothar - avatar
+ 5
CHRISTIAN , just correct the output string as mentioned, then the code will pass all test cases.
12th Jan 2024, 5:42 PM
Lothar
Lothar - avatar
+ 2
Thanks guys... Lothar u rock man!
12th Jan 2024, 6:05 PM
CHRISTIAN
CHRISTIAN - avatar
+ 2
Sniper sight Rain...
12th Jan 2024, 6:06 PM
CHRISTIAN
CHRISTIAN - avatar
+ 1
That's the point, Lothar... Bt somehow there seems to be something missing...🤦
12th Jan 2024, 5:39 PM
CHRISTIAN
CHRISTIAN - avatar
+ 1
I don't understand...
12th Jan 2024, 5:45 PM
CHRISTIAN
CHRISTIAN - avatar
0
Still the same issues...
12th Jan 2024, 5:55 PM
CHRISTIAN
CHRISTIAN - avatar