who has the higher batting average: ted, who has 12 hits in 30 at bats, or pete, who has 18 hits in 40 at bats? why?

Divide:

12/30 = 0.4
18/40 = 0.45