Obama poked fun at opponents of the deal during an appearance on Comedy Central's "The Daily Show." He said those critics think if only Cheney had been there, "everything would be fine."
Obama said Iran is an adversxary that is anti-American and anti-Israel. But he said you don't make peace with your friends. Obama added that the U.S. doesn't have to give anything up in the Iran deal and said the next president will have more options because of the agreement.
Stewart pressed Obama on a number of government missteps that have attracted controversy, including the Veterans Affairs scandal and IRS targeting of some political groups.
Obama said he understands he will leave office without satisfying every one of his goals. But he said the country is better off than it was when he took office.
"If we lose sight of that, then we're feeding into this narrative that there's nothing we can do," Obama said.
Obama has appeared seven times on "The Daily Show," three times as president. In previous appearances, Stewart has challenged the president with hard-hitting questions about his drone policy, Benghazi and other issues. The White House has sought out Stewart's show because of its broad appeal to younger American audiences.
Tuesday's interview had an air of finality, coming just two weeks before Stewart signs off for the last time. For 16 years Stewart has been at the helm of the show, roasting politicians and serving up a comedic take on the day's news and political developments.
Stewart will be replaced on the show by Trevor Noah, a South African coamedian who will take over Sept. 28.