The U.S. has been named the most powerful country in the world for the seventh time, according to the latest rankings by the Wharton School of the University of Pennsylvania and U.S. News & World Report.

The U.S. also returned to the top five countries overall, rising from sixth place in 2021 to fourth. They were surpassed by Switzerland, Germany and Canada, and Sweden moved up four spots to fifth place.

The ratings were based on responses from more than 17,000 people in 36 countries. The ratings were compiled equally from three groups: the general population, high-income earners and business decision makers.

A strong U.S. job market this year has also boosted Americans' happiness levels. In 2021, only 4 percent of respondents said they had a good job market, but that number rose to 96 percent this year.

Despite the high job opportunities, the U.S. still fell from 20th to 21st in overall quality of life.

As of Oct. 20, there had been 546 mass shootings in the country, according to the charity Gun Violence Archives.

Compared to the U.S., 95 percent of respondents consider Switzerland, which was named the best country in the world, to be a safe country.