Home assignment 3#
Last updated: 2023-05-27 16:41:15
world_cities.csvfile into a
Calculate and print a new table, where each row represents a country, with the following columns:
"capital"—The name of the capital city
"pop_total"—The total population (population in all cities summed)
Note that for some countries there is more than one value marked as the capital! The resulting table still needs to have one row per country: capital name (
"capital") should be the first if there is more than one, while total population (
"pop_total") needs to be the sum of all cities (regardless of duplicates).
|3||American Samoa||Pago Pago||58021|
|4||Andorra||Andorra la Vella||69031|
|223||Wallis and Futuna||Mata'utu||11380|
228 rows × 3 columns
The text file named
bgu.wkt(see Sample data) contains a WKT string representing the geometry of the BGU logo.
Read the WKT string from the
bgu.wktfile, using the
.readlinemethods (see Working with files). Convert the string into a
Note: Do not copy and paste the WKT string into your code! You need to read it from the
Display the logo graphically.
Calculate the area of the logo.
Calculate a circle that is enclosing the logo. To do that, first calculate the average of x-axis bounds and the average of the y-axis bounds, then construct a point according to those x and y values, and finally buffer the point to a distance of your choice so that the logo is completely within the buffer.
Calculate the geometry of the difference between the logo and the bouding circle you calculated, then plot it.