[Tutor] Beginner's question: Looping through variable & list simultaneously

Dave Angel davea at davea.name
Tue Dec 3 14:11:01 CET 2013


On Tue, 3 Dec 2013 13:55:31 +0100, Rafael Knuth 
<rafael.knuth at gmail.com> wrote:
> for x in range(2009, 2014):




> PopularCountries = ["Brazil", "China", "France", "India", "Vietnam"]

You can zip two iterators together and iterate through the resultant 
iterable of tuples. 

for x, country in zip (range (2009, 2014)):
    Print (x, country)

-- 
DaveA



More information about the Tutor mailing list