0

National Economic Freedom-Python

Ok, so I was doing this exercise and I wrote this code: data = { 'Singapore': 1, 'Ireland': 6, 'United Kingdom': 7, 'Germany': 27, 'Armenia': 34, 'United States': 17, 'Canada': 9, 'Italy': 74 } entry=input() if entry in data: print(data.get(entry)) else: print("Not Found") I think it is the most adequate answer, and the first four tests are correct but the fifth and the sixth aren't, and they are not shown, so I don't know why it doesn't work, if someone could tell me what's wrong...

6th Dec 2021, 7:32 PM
Daniel Clariana Arencibia
Daniel Clariana Arencibia - avatar
5 ответов
+ 4
Your solution is: data = { 'Singapore': 1, 'Ireland': 6, 'United Kingdom': 7, 'Germany': 27, 'Armenia': 34, 'United States': 17, 'Canada': 9, 'Italy': 74 } entry=input() if entry in data.keys(): print(data.get(entry)) else: print("Not Found") Because you are specifying that it is in the names of the countries. I hope you understand me, any doubt ask me.
7th Dec 2021, 12:58 AM
CGO!
CGO! - avatar
7th Dec 2021, 1:41 AM
CGO!
CGO! - avatar
+ 3
the reason why you struggle is only due to the incorrect spelling of the output message. if has to be: " Not found". in your code "Found" is spelled with a capital letter, but should be lower case. ^ this is the only issue you have to change.
7th Dec 2021, 8:42 PM
Lothar
Lothar - avatar
+ 2
7th Dec 2021, 1:30 AM
Python Learner
Python Learner - avatar
0
data = { 'Singapore': 1, 'Ireland': 6, 'United Kingdom': 7, 'Germany': 27, 'Armenia': 34, 'United States': 17, 'Canada': 9, 'Italy': 74 } name = input() if name in data: print(data[name]) else: print("Not found")
17th May 2022, 8:19 AM
Junior Jackson
Junior Jackson - avatar