Intermediate Python Dictionary Functions | Sololearn: Learn to code for FREE!

+1

Intermediate Python Dictionary Functions

I can get 4/6 tests passed, however, I am not sure what I am doing wrong here. The code is supposed to take the country name as input and output the corresponding key. If the country is not present, it is supposed to print 'Not Found'. Here is my code: data = { 'Singapore': 1, 'Ireland': 6, 'United Kingdom': 7, 'Germany': 27, 'Armenia': 34, 'United States': 17, 'Canada': 9, 'Italy': 74 } print(data.get(input(), 'Not Found'))

10/12/2021 4:54:05 PM

Josh Haefner

2 Answers

New Answer

+5

Hi Josh! We don't see any error in your code. So, we can assume that the problem is in output string "Not Found". Please double check it's in a correct format. Upper , lower cases matter.

+3

if has to be "Not found"