# Round number to nearest integer

I've been trying to round long float numbers like:

```
32.268907563;
32.268907563;
31.2396694215;
33.6206896552;
...
```

With no success so far. I tried `math.ceil(x)`

, `math.floor(x)`

(although that would round up or down, which is not what I'm looking for) and `round(x)`

which didn't work either (still float numbers).

What could I do?

EDIT: CODE:

```
for i in widthRange:
for j in heightRange:
r, g, b = rgb_im.getpixel((i, j))
h, s, v = colorsys.rgb_to_hsv(r/255.0, g/255.0, b/255.0)
h = h * 360
int(round(h))
print(h)
```

```
int(round(x))
```

Will round it and change it to integer

EDIT:

You are not assigning int(round(h)) to any variable. When you call int(round(h)), it returns the integer number but does nothing else; you have to change that line for:

```
h = int(round(h))
```

To assign the new value to h

From: stackoverflow.com/q/31818050