Starting from previous Google Colab notebook
The following steps will serve as a guideline to find all pairs from five selected countries:
Load the notebook with commands developed in step 2.1. (click on the link):
https://colab.research.google.com/drive/1-2AUAiSZ1TqRFAomTGDU3WP0MIaookXy?usp=sharing
Create a list with the name of the five selected countries:
list_names = ['Afghanistan', 'Albania', 'Algeria', 'American Samoa', 'Andorra']
Use the command combinations from the itertools package to compute all possible pairs:
import itertools
combinations = itertools.combinations(list_names, 2)
list_pairwise_comb = list(combinations)
[('Afghanistan', 'Albania'),
('Afghanistan', 'Algeria'),
('Afghanistan', 'American Samoa'),
('Afghanistan', 'Andorra'),
('Albania', 'Algeria'),
('Albania', 'American Samoa'),
('Albania', 'Andorra'),
('Algeria', 'American Samoa'),
('Algeria', 'Andorra'),
('American Samoa', 'Andorra')]
Select the first generated pair with the command list_pairwise_comb[0] and store it at variable first_pair:
first_pair = list_pairwise_comb[0]
('Afghanistan', 'Albania')
Select the first element of the first pair first_pair[0]:
first_pair[0]
'Afghanistan'
The Python code with all the steps is summarized in this Google Colab (click on the link):
https://colab.research.google.com/drive/1B2xiY2xg-VL_tWxJfqNKXAbTuBio2ksJ?usp=sharing