Maddy is eating 2 eggs each day after school and there are 5 school days in a week, so she eats 2 x 5 = <<2*5=10>>10 eggs each week.
Since Maddy has 40 eggs / 10 eggs each week, they will last 4 weeks.
#### 4