A paint calculator works out how many gallons you need for a room, based on the wall area and how many coats. Enter your measurements and it sizes the paint, so you buy enough to finish without a mid-job run to the store - or a shelf of leftover cans.
Paint is heavy and ships poorly, so most people buy it locally - but the supplies that make the job painless (a good roller kit, drop cloths, painter's tape) ship to your door, and that is what the shopping list focuses on.
Paint needed = wall area times coats, divided by the spread rate (about 350 sq ft per gallon for interior wall paint), rounded up to whole gallons. Primer, deep colours and rough or porous surfaces lower the spread rate and may need an extra coat.
A room with a 40 ft perimeter and 9 ft walls is 360 sq ft. At two coats and ~350 sq ft per gallon, that is 2.1 gallons - round up to 3 one-gallon cans.