Julia Pais Anal May 2026
# Simple pretty‑printer for the report. function Base.show(io::IO, r::CountryReport) i = r.info @printf io "Country: %s (%s / %s)\n" i.name i.iso2 i.iso3 @printf io "Official name: %s\n" i.official_name @printf io "Capital: %s\n" join(i.capital, ", ") @printf io "Region / Subregion: %s / %s\n" i.region i.subregion @printf io "Population: %'d\n" i.population @printf io "Area: %'.2f km²\n" i.area_km2 @printf io "Population density: %'.2f people/km²\n" r.density @printf io "Languages: %s\n" join(i.languages, ", ") @printf io "Currencies: %s\n" join(i.currencies, ", ") @printf io "Flag: %s\n" i.flag_url if r.gdp_per_capita !== missing @printf io "GDP per capita (USD): $%'.2f\n" r.gdp_per_capita @printf io "Economic weight (pop × GDP/Capita): $%'.2f\n" r.economic_weight else @printf io "GDP data not supplied.\n" end end
# Turn a dictionary of currencies (e.g. "USD"=>"name"=>"United States dollar","symbol"=>"$") into a vector of strings. function currencies_from_dict(dict::Dict) return [string(v["name"], " (", get(v, "symbol", "?"), ")") for (_, v) in dict] end julia pais anal
""" CountryReport
You can extend any of the steps (e.g., add more fields, plug in a different data source, or compute extra statistics). # -------------------------------------------------------------- # Country analysis feature for Julia # -------------------------------------------------------------- using HTTP using JSON3 using DataFrames # optional, only needed if you want tabular output using Statistics # for mean, median, etc. using Printf # for nice formatting # Simple pretty‑printer for the report
Fetches basic data for the given country from the REST Countries API, computes population density, and (optionally) merges a GDP‑per‑capita value from a user‑provided `gdp_table`. ")") for (_