Run Code  | API  | Code Wall  | Misc  | Feedback  | Login  | Theme  | Privacy  | Patreon 

Ej2_PYTHON_203700377.

·juan_contreras_henriquez

·203700377


n=int(input())              
while(n<1 and n>50):
    n=int(input())

x=float(input())
while(x<-10.0 and x>10.0):
    x=float(input())

p=0                             
potencia=0                      
oper=0                  
a=0                             
while(p<n):                     
    factorial=1
    for i in range(2,a+1):      
        factorial=factorial*i
    a=a+3   
    if(p%2==0):
        oper=oper+((x**potencia)/factorial) 

    else:                                                 
        oper=oper-((x**potencia)/factorial) 
    potencia=potencia+3
    p=p+1                       
print("Omega (",x,") para",n,"termino(s) =",oper)   
 run  | edit  | history  | help 0