Explain the following code please | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
16th May 2020, 9:35 AM
Teja Swaroop
Teja Swaroop - avatar
2 Antworten
+ 1
Hi, can you be more precise about what you need explanations for? In short I see that the code defines a list named "n" and then defines a new list named "m" by applying a cut on the "n" list. And does it a lot of times (so the values of "n" and "m" are reset each time). A cut is defined by the elements between brackets [start cut : end cut : steps of the cut] If you have n[1:8:2] it says : "cut the n-list from item one, up to item 8, and make steps of two items in between. Negative numbers work on the opposite direction. There is a very good python course on solo learn about it, that will show you better than a long explaination here! All the best
16th May 2020, 9:56 AM
Pierre
0
Thanks for clearing my doubt
16th May 2020, 10:34 AM
Teja Swaroop
Teja Swaroop - avatar