samedi 20 février 2021

Python - evaulate elements in list of lists

Trying to learn Python and got this task to find if there is a consecutive year-over-year improvement (higher score) from 2003-2018 for any of the countries.

Given list:

lst=[[;2018;2015;2012;2009;2006;2003],[Country1;558;544;538;525;525;527],[Country2;551;548;561;555;547;550],[Country3;545;538;536;534;533;529],[Country4;526;524;554;546;547;542]]

The list is a lot longer than the sample. The countries with counsecutive year-over-year improvement shall be presented in a table. Second task is to do the same, but for countries with year-over-year lower score.

No imports are allowed.

I'm think that I need to do some if-searches in a for-loop, but I'm drawing a blank here really. I can't wrap me head around it really.

Any strategy tip or code samples are much appreciated.

Aucun commentaire:

Enregistrer un commentaire