Skip to content

IDCE-MSGIS/302-Lab5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Lab 5 – Refugee Stats using Dictionaries

To complete this lab you will need to add a .py script that contains your code (be sure it is well commented!) and edit this README file.

You can write your script using whatever tools you like, but it must include a comment block at the top with the following information:

  • Name:
  • Date created:
  • Version of Python you are using
  • Very brief description of the assignment or the assignment name. Include inputs and outputs.

You should edit your README file to provide the following information:

  • Summarize what your script does or the problem you were trying to solve.
  • Summarize any major errors you encountered and what sources they used to resolve the errors
  • How you fixed the errors, or where the error is if you couldn't figure something out.

Remember that you are encouraged to look for answers online! Stackoverflow, other Github repositories, or Python documentation are all good places to start.

The Code

This week you will create a small dictionary of Refugee and iterate through it to create basic outputs.

  1. Review the data table located under the Refugee camps by country and population section: https://en.wikipedia.org/wiki/Refugee_camp
  2. Create a dictionary with 5 key-value pairs consisting of a country name and an integer that represents the number of refugees in refugee camps in the selected country, for a year of your choice. The dictionary should represent country names as keys and the population as values.
  3. Define a function that will print out just the countries' names, by looping through the keys of your dictionary.
  4. Define a function that will print out just the populations, by looping through the values of your dictionary.
  5. Print out a series of statements telling how many refugees are in each country: "CountryX has 1234567 refugees."

Revise your output, if necessary. Make sure there is an introductory sentence or comment describing the output for each loop you write.

About

Refugee Stats using Dictionaries

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published