(Reuters) - The three major U.S. stocks indexes ended higher on Friday, snapping three days of losses, as investors bet on slower U.S. rate hikes, but gains were muted by increasingly aggressive exchanges between the United States and North Korea.

Weaker-than-expected July consumer price data led investors to bet that benign inflation would keep the U.S. Federal Reserve from raising rates again this year.

While this gave investors some hope after a jittery week, there were still signs of nervousness in choppy late afternoon trading, primarily due to ongoing threats between the United States and North Korea.

President Donald Trump said Friday that the U.S. military was “locked and loaded,” while Pyongyang accused him of driving the Korean peninsula to the brink of nuclear war. He told reporters in the late afternoon that he hoped North Korea “fully” understood the gravity of his warning about taking military action against the United States or its allies.

While the data gave investors appetite for growth sectors such as information technology and biotechnology it soured them to rate-sensitive stocks such as banks, said Keith Lerner, Chief Market Strategist, SunTrust Advisory services in Atlanta.

“There’s not a great incentive to buy big. You’re less than 2 percent off the high for the S&P heading into a weekend where uncertainty with North Korea still lingers,” said Lerner.

The Dow Jones Industrial Average .DJI rose 14.31 points, or 0.07 percent, to 21,858.32, the S&P 500 .SPX gained 3.11 points, or 0.13 percent, to 2,441.32 while the Nasdaq Composite .IXIC added 39.68 points, or 0.64 percent, to 6,256.56.

For the week the S&P fell 1.4 percent and the Dow lost 1.1 percent - their largest weekly drops since the week ending March 24 - and the Nasdaq was off 1.5 percent.

Robert Phipps, a director at Per Stirling Capital Management in Austin, said he was reassured after Dallas Fed President Rob Kaplan said the Fed needs evidence of progress toward its inflation goal before raising rates.

People walk by New York Stock Exchange in the financial district in New York, U.S., August 10, 2017. REUTERS/Eduardo Munoz

“If earnings can stay strong and interest rates remain low, investors can look beyond North Korea and continue to rally equities,” said Phipps.

Traders saw the chance of a rate hike in December falling to 40 percent from 42 percent before Friday’s data, according to Federal funds futures.

Nearly $1 trillion has been wiped out from global equity markets since Trump’s vow on Tuesday to unleash “fire and fury” on North Korea if it threatens the United States.

Five of the 11 major S&P sectors ended higher, with technology's .SPLRCT 0.75-percent rise leading the advancers.

But the S&P Bank sub-sector .SPXBK fell 0.7 percent on dimming prospects of another rate hike this year since higher rates tend to boost bank profits.

While the Russell 2000 index .RUT ended up 0.1 percent on the day, it was more than 5 percent below its July 25 record close and for the week it fell 2.7 percent, its biggest weekly drop since February 2016.

Shares of Snap SNAP.N ended down 14 percent after hitting a record low following a miss on revenue and daily active users. At least 12 brokerages cut their price targets on the stock.

J.C. Penney JCP.N finished down 16.6 percent after hitting a record low following the retailer's bigger-than-expected quarterly loss.

Advancing issues barely outnumbered decliner on the NYSE by a 1.15-to-1 ratio; on Nasdaq, a 1.10-to-1 ratio favored advancers.

About 6.15 billion shares changed hands on U.S. exchanges, below the 6.29 billion average for the last 20 sessions.