For many students, community college provides a secondary education at a more attainable and affordable price. But just like major universities differ in terms of what you get for what you pay, some community colleges stack up better than others.

WalletHub's 2018 Best and Worst Community Colleges Study looked at 715 schools listed as member institutions in the American Association of Community Colleges (the study notes that due to data limitations, it could not include all member schools). WalletHub then looked at 17 metrics, including factors like cost of in-state tuition and fees, per-pupil spending and student faculty ratio, from across three key dimensions: cost and financing, education outcomes and career outcomes. Ultimately, schools were ranked on a 100-point scale, with 100 representing the best community college.

Topping WalletHub's list of the best community colleges is Arkansas State University-Mountain Home, with a total score of 66.13. The school boasted high rankings across all three key dimensions, particularly in the education outcomes category. Coming in second is Stella and Charles Guttman Community College in New York City. Its high ranking was likely due to its top spot in the cost and financing category.

Rounding out WalletHub's top three is the State Technical College of Missouri, which boasts an impressive number one ranking in education outcomes and a number two ranking in career outcomes.

Here are the top five best community colleges in the U.S., according to WalletHub's study:

1. Arkansas State University-Mountain Home

Location: Mountain Home, Arkansas

Score: 66.13

2. Stella and Charles Guttman Community College

Location: New York, New York

Score: 65.28

3. State Technical College of Missouri

Location: Linn, Missouri

Score: 64.71

4. Alexandria Technical & Community College

Location: Alexandria, Minnesota

Score: 64.16

5. Northland Community and Technical College

Location: East Grand Forks and Thief River Falls, Minnesota

Score: 64.07

Meanwhile, falling to the very bottom of the list is Eastern Gateway Community College, located in Ohio. This school had poor rankings across all three key dimensions, earning it an overall score of 27.21. The second worst community college, according to WalletHub, is Hudson County Community College in New Jersey, followed by Lac Courte Oreilles Ojibwa Community College, in Wisconsin.

Here are the five worst community colleges in the U.S., according to WalletHub's study:

1. Eastern Gateway Community College

Location: Steubenville and Youngstown, Ohio

Score: 27.21

2. Hudson County Community College

Location: Jersey City, New Jersey

Score: 27.72

3. Lac Courte Oreilles Ojibwa Community College

Location: Hayward, Wisconsin

Score: 29.92

4. Denmark Technical College

Location: Denmark, South Carolina

Score: 30.35

5. Bladen Community College

Location: Dublin, North Carolina

Score: 32.33

Don't miss: Best states and cities for small business, graded from A+ to F (Hint: 5 states did stellar and 2 flunked)

Like this story? Subscribe to CNBC Make It on YouTube!