```
if i% math.ceil(num_iters/10) == 0:
```

I didn’t understand what this line refers to, especially, math.ceil(). The line is from graded assignment of course1 week2.

```
if i% math.ceil(num_iters/10) == 0:
```

I didn’t understand what this line refers to, especially, math.ceil(). The line is from graded assignment of course1 week2.

Hello @Subash_Tamang, ceil() is a function defined in math library which ceils the value of a floating number to the nearest integer which is greater than floating value. For e.g., ceil(3.4) will give 4.

ceil(3.0) will give 3.

ceil(4.9) = 5

The line

if i% math.ceil(num_iters/10) == 0:

does as following.

Suppose num_iters = 55

then math.ceil(55/10) = math.ceil(5.5) = 6

then i % 6 == 0 will be true when i is a multiple of 6.

So, cost will gets printed whenever i is multiple of 6. i.e., 0,6,12,18,… and weight at those iterations will be added to w_history at these values of i.

1 Like