How can I obtain the sum of populations from a file. Need help please

You must select a tag to post in this category. Please find the tag relating to the section of the course you are on

When you ask a question, don’t forget to include a link to the exercise or project you’re dealing with!

If you want to have the best chances of getting a useful answer quickly, make sure you follow our guidelines about how to ask a good question. That way you’ll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer! :slight_smile: strong text


First you need to know how to do deal with your file (because that will deal how you parse it). It’s very common to parse .csv files but you may have something else. In which case you’ll vary your technique.

Anyways, you load the file and then see how to access the desired field. If you can iterate through all the instances you can tally up the sum in some result variable.

This is all fairly straightforward to do with something like the Pandas framework in python. But it should still be very doable in C#. Just look up the information in steps (e.g.: “how do i open a x-type file in C#”).

1 Like

Thank you for your suggestion.
It is very helpful.
This is a hint of the project.


Afghanistan Kaboul 25500100 Asie
Afrique du Sud Pretoria 52981991 Afrique
Albanie Tirana 2821977 Europe
Algerie Alger 38700000 Afrique
Allemagne Berlin 80619000 Europe
Andorre Andorre-la-Vieille 76098 Europe
Angola Luanda 20609294 Afrique
Antigua-et-Barbuda Saint John’s 86295 Amerique
Arabie saoudite Riyad 29994272 Asie
Argentine Buenos Aires 41660096 Amerique
Armenie Erevan 3017400 Asie
Australie Canberra 23414552 Oceanie
Autriche Vienne 8504850 Europe
Azerbaidjan Bakou 9477100 Asie
Bahamas Nassau 351461 Amerique
Bahrein Manama 1234571 Asie
Bangladesh Dacca 152518015 Asie
Barbade Bridgetown 285000 Amerique
Belgique Bruxelles 11132269 Europe
Belize Belmopan 349728 Amerique
Benin Cotonou 10323000 Afrique
Bhoutan Thimphou 745200 Asie
Bielorussie Minsk 9468100 Europe
Birmanie Pyinmana 53259000 Asie