Skip to content

I made a simple program to find the capital of a country in python. If you are interested, please try it.

Notifications You must be signed in to change notification settings

SuluJulianto/country-capital

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

country-capital

This Python script provides a seamless way to link countries with their respective capitals. The underlying data for this script is derived from two Indonesian-language websites:

  1. CNBC Indonesia
  2. IDN Times

Functionality

Users can input a country's name and instantly retrieve its corresponding capital. The output displays the capital city of the entered country. Additionally, the script randomly showcases the capital of another country, providing users with diverse country-capital pairs for exploration.

Code Structure

The functionality is implemented through a dictionary structure in Python. Country names serve as keys, while their corresponding capitals are stored as values. If the entered country does not match any entry in the dataset, the script informs the user about the absence of that country in the database.

Additional Information

To enhance user experience, the code also includes a feature that randomly displays the capital of a different country, broadening the scope beyond the initial query.

Please note that the code's explanations and functionality details are provided in English, but the sources for the country-capital data are Indonesian-language websites.

About

I made a simple program to find the capital of a country in python. If you are interested, please try it.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages