hgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershsshgfjfyuffyufuyfy yfyrtershssestoy realizando un intérprete de LISP en Python, específicamente con las operaciones aritméticas elementales (+ - * /), he logrado realizar las operaciones de expresiones como por ejemplo ( + 10 -15 2 ) o ( * 7 6 7 3 ). Ahora, para expresiones como ( + ( * ( / 8 7 ) 15 ) -2 ) no logro poder emplear lo que realicé para las expresiones anteriores, aquí el código empleado.
def sumalista(lista):
i=1
suma = 0
for i in lista:
suma = suma + i
return suma
def productolista(lista):
i=1
producto=1
for i in lista:
producto=producto*i
return producto
m=input("Introduce la s-expression:");
y=m.split()
if y[1]=="+":
y_1=y[3:len(y)-1]
x=list(map( float, y_1))
print(float(y[2])+sumalista(x))
elif y[1]=="-":
y_1=y[3:len(y)-1]
x=list(map( float, y_1))
print(float(y[2])-sumalista(x))
elif y[1]=="*":
y_1=y[3:len(y)-1]
x=list(map( float, y_1))
print(float(y[2])*productolista(x))
elif y[1]=="/":
y_1=y[3:len(y)-1]
x=list(map( float, y_1))
print(float(y[2])*1/productolista(x))