Hope someone can help me out here. I am using a for loop inside a for loop in Python. That is a nested-for-loop and I want to map the results together once. At the moment the results are displayed correctly once and then incorrectly repeated. This is my code snippet.
for country in ["USA", "Nigeria", "Germany", "India", "Britain"]:
for code in ["+1", "+234", "+49", "+91", "+44"]:
print(country, code)
print("Done")
The result I am trying to achieve is this one.
USA +1
Nigeria +234
Germany +49
India +91
Britain +44
Done!
But what I am getting at the moment is this one.
USA +1
USA +234
USA +49
USA +91
USA +44
Nigeria +1
Nigeria +234
Nigeria +49
Nigeria +91
Nigeria +44
Germany +1
Germany +234
Germany +49
Germany +91
Germany +44
India +1
India +234
India +49
India +91
India +44
Britain +1
Britain +234
Britain +49
Britain +91
Britain +44
Done
Is there a way I can improve it and get the desired result? I will appreciate your help.