On 03/12/2013 15:51, Steven D'Aprano wrote:

Here's a modification to your earlier code using zip:

PopularCountries = ["Brazil", "China", "France", "India", "Vietnam"]
Backpackers = 1000000
msg = "In %d there were %d backpackers worldwide and their most popular country was 
%s."
for year, country in zip(range(2009, 2014), PopularCountries):
     Backpackers = Backpackers*1.15
     print(msg % (year, Backpackers, country))


So much for "There should be one-- and preferably only one --obvious way to do it." :)

--
My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language.

Mark Lawrence

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to