This shows you the differences between two versions of the page.
ii:labs:s2:01:tasks:03 [2023/03/18 19:58] florin.stancu |
ii:labs:s2:01:tasks:03 [2024/03/15 13:30] (current) florin.stancu [03. [20p] Making the list] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== 03. Making the list ==== | + | ==== 03. [25p] Making the list ==== |
Solve these subtasks all in the same file (use ''print()'' statements to display the results): | Solve these subtasks all in the same file (use ''print()'' statements to display the results): | ||
Line 9: | Line 9: | ||
Well: | Well: | ||
- | * Sort the list (note: save the original one!); | + | * Sort the list (does it work? if not, why?); |
- | * Reverse the list (this again?); | + | * Reverse the list (this again? note: save the original one!); |
* Filter out all non-numbers from the list (i.e., only ''int'' type values should remain)... can you make it using **a single line of code**? now it's the time to introduce [[https://docs.python.org/3/tutorial/datastructures.html#list-comprehensions|list comprehensions]]; | * Filter out all non-numbers from the list (i.e., only ''int'' type values should remain)... can you make it using **a single line of code**? now it's the time to introduce [[https://docs.python.org/3/tutorial/datastructures.html#list-comprehensions|list comprehensions]]; | ||
<note> | <note> |