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
7 Respostas
+ 7
I think it may be "Not found".
'N' is uppercase in Not found.
Check it again
+ 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")
0
Thanks it worked
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")
0
u may need capital n in "not found"
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.
- 1
what is the description/requirement of this 'pro' code coach?