Puzzle 4: Round and Round We Go

Let's exercise our minds by solving a rounding puzzle.

We'll cover the following

Guess the output

Try to guess the output of the code below:

Press + to interact
import pandas as pd
s = pd.Series([-2.5, -1.5, -0.5, 0.5, 1.5, 2.5])
print(s.round())

Quiz

Q

What is the output of the code above?

A)
0   -2.0
1   -2.0
2   -0.0
3    0.0
4    2.0
5    2.0
B)
-2.0
-2.0
-0.0
0.0
2.0
2.0
C)
0   -3.0
1   -2.0
2   -1.0
3    1.0
4    2.0
5    3.0
D)
-3.0 -2.0 -1.0 1.0 2.0 3.0

Get hands-on with 1300+ tech skills courses.