What job did barack obama have before being president?

He was a U.S. Senator from the state of Illinois.