In a surprise courtroom appearance here today, newspaper fortune heiress Patricia Hearst entered a no contest plea to two charges from her former political terrorist days that could carry sentences of up to life imprisonment.

Hearst, 23, flanked by two of her defense attorneys, appeared this morning before Superior Court Judge E. Talbot Callister and softly whispered "nolo contendere" to charges of armed robbery and assault with a deadly weapon. The judge immediately accepted the plea and declared her guilty on both charges.

Callister set May 9 as the date for sentencing of Hearst, who is already free on $1,250,000 bail pending an appeal of her seven-year sentence on a federal bank robbery conviction last year in San Francisco. Todays charges each carry a prison term ranging from 10 year to life.

Hearst chief defense attorney Albert Johnson had consistently declared before today's plea that his client could not get a fair trial anywhere in the United because of the widespread publicity attached to her trial and conviction in San Francisco.

Johnson refused to comment on why the plea was made but said no plea bargaining had taken place on Hearst's behalf.

In return for her no contest plea here today, Los Angeles Deputy District Attorney Samuel Mayerson declared that nine other felony charges against Hearst including two of kidnapping - would be dropped.

The charges stem from a 1974 shootout in front of a sporting goods store in suburban Inglewood, Calif., in which Hearst and two of her former Symbionese Liberation Army companions, Bill and Emily harris, took part. Both Harrises were found guilty last September of kidnapping, auto theft and robbery and sentenced to 11 years to life.

Mayerson said today that there had been no plea bargaining "in the sense in which the term is commonly used." Hearst has, however, supplied information about the SLA to law enforcement officials in several federal and state jurisdiction since her capture in 1975.

She was kidnaped by the SLA Feb. 4, 1974, from an apartment in Berkeley, Calif., setting off one of the most widely publicized political terrorist stories in years.

Mayerson was scheduled to lead the prosectuion of Hearst May 18 when she was to have been tried on the 11 state charges related to the shootout.

"There was no arrangement made for anything," Mayerson said after today's proceedings. "People always allowed to plead guilty to the most serious charges against them and this follows our office's set procedures."

Nevertheless, the deputy district attorney said he was somewhat surprised at Hearst's no contest plea. "I came into court his morning prepared to argue motions I thought her defense attorneys were going to make," he said. "I was even going over a list of what kind of jurors we would want at the trial."

Hearst was accompanied today by several of the armed guards hired by her family to protect her since her release on bail on the federal charges No. 19.

Her parents, newspaper executive Randolph Hearst and his wife, Catherine, sat quietly in the first row of the courtroom watching the little show of emotion, as they have through most of their daughter's numerous court appearances.

Authorities have said that Hearst's sentence on the two charges could takes months to be determined.

A full probation study must still be prepared on Hearst and a change in California's sentencing law could further delay the sentencing officials said.

Under the present law a judge may sentence a felon to an indeterminate term with the actual time served dependent on a number of factors such as prison behavior and cooperation in pending cases. The practice is quite common in California courts, especially where a case has sensitive overtones such as Hearst's.

But after July 1 the law requires that all new sentences and any existing indeterminate ones must be specifically spelled out. The sentence times will be set by a nine-member Community Release Board appointed by Gov. Edmund G. Brown Jr.