ls = [16, 81, 23, 74, 91, 612, 33, 812]
ls[2:6:3] #Starting from index 2 till index 5 and skip the next 2 indices
ls[::-1] # Reverse list is printed
Only 2nd line i.e. ls[::-1]
is executed. What am I doing wrong ?
ls = [16, 81, 23, 74, 91, 612, 33, 812]
ls[2:6:3] #Starting from index 2 till index 5 and skip the next 2 indices
ls[::-1] # Reverse list is printed
Only 2nd line i.e. ls[::-1]
is executed. What am I doing wrong ?
It does execute all the lines, it only output the last one by default.
If you want to see all the steps, you can print
the result you want to see.
This answer also gives an alternative by asking jupyter to show all output systematically by adding
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
Please restart your jupyter-notebook again and also refresh jupyter. Hope its helpful..