August 2021
Beginner to intermediate
112 pages
1h 29m
English
| Puzzle 15 | Free-Range |
| | import pandas as pd |
| | |
| | df = pd.DataFrame([ |
| | [1, 1, 1], |
| | [2, 2, 2], |
| | [3, 3, 3], |
| | [4, 4, 4], |
| | [5, 5, 5], |
| | |
| | ]) |
| | |
| | print(len(df.loc[1:3])) |
Guess the Output | |
|---|---|
|
|
Try to guess what the output is before moving to the next page. |
This code will print: 3
Slices in Python are half-open ranges. You get values from the first index, up to but not including the last index:
| | In [1]: chars = ['a', 'b', 'c', 'd', ... |
Read now
Unlock full access