0
How can I access or work with dictionary values(especially list)
I wanted to check if a country exist in the list(dictionary value), but the only True condition(country available) I get is for only first country(element) in each list.If i try other elements(country) in the list I didn't get the expected output https://code.sololearn.com/ccNvrNgON6om/?ref=app
3 Answers
+ 1
It does work as intended. I commented out your file input and manually constructed a reduced version of your dict just to test it and it worked ok.
0
This is what 'continent.txt' looks like
Africa:Nigeria, Ethiopia, Egypt, Democratic_Republic_of_the_Congo, Tanzania, South_Africa, Kenya, Uganda, Algeria, Sudan, Morocco, Angola, Mozambique, Ghana, Madagascar, Cameroon, CĂŽte_d'Ivoire, Niger, Burkina_Faso, Mali, Malawi, Zambia
Asia:China, India, Indonesia, Pakistan, Bangladesh, Japan, Philippines, Vietnam, Turkey, Iran, Thailand, Myanmar, South_Korea, Iraq, Afghanistan, Saudi_Arabia, Uzbekistan, Malaysia, Yemen, Nepal, North_Korea
Europe:Russia, Germany, United_Kingdom, France, Italy, Spain, Ukraine, Poland, Romania, Netherlands, Belgium, Czechia, Greece, Portugal, Sweden, Hungary, Belarus, Austria, Serbia, Switzerland
0
rodwynnejones ah yes... I get it... Each element in the list needs to be in quotes.. Thanks đđ