0

Trying to solve National Economic Freedom in intermediate python

Here is the code i used user_input=input() data = { 'Singapore': 1, 'Ireland': 6, 'United Kingdom': 7, 'Germany': 27, 'Armenia': 34, 'United States': 17, 'Canada': 9, 'Italy': 74 } print(data.get(user_input,"not found" )) But test case 5 and 6 still comes out wrong

24th Mar 2021, 3:16 PM
Simisola Osinowo
Simisola Osinowo - avatar
7 Réponses
+ 7
I think it may be "Not found". 'N' is uppercase in Not found. Check it again
24th Mar 2021, 4:22 PM
Simba
Simba - avatar
+ 2
data = { 'Singapore': 1, 'Ireland': 6, 'United Kingdom': 7, 'Germany': 27, 'Armenia': 34, 'United States': 17, 'Canada': 9, 'Italy': 74 } key=input() if key in data: print(data[key]) else: print("Not found")
13th Oct 2021, 11:21 AM
Kholdarov Ilyosjon
Kholdarov Ilyosjon - avatar
0
Thanks it worked
24th Mar 2021, 4:51 PM
Simisola Osinowo
Simisola Osinowo - 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:20 AM
Junior Jackson
Junior Jackson - avatar
0
u may need capital n in "not found"
17th Aug 2023, 6:58 AM
haitue
0
data = { 'Singapore': 1, 'Ireland': 6, 'United Kingdom': 7, 'Germany': 27, 'Armenia': 34, 'United States': 17, 'Canada': 9, 'Italy': 74 } x = input() print(data.get(x, "Not found")) After the comma, you can note the default value of dic.
23rd Aug 2023, 11:37 AM
Kikvi
Kikvi - avatar
- 1
what is the description/requirement of this 'pro' code coach?
24th Mar 2021, 3:38 PM
visph
visph - avatar