利用循环语句解决:x-x/2+x/3-x/4……x/50
x=float(input()) s=-1.0 res=0.0 for i in range(1,51): s*=-1; res+=(s*x/i) print(res)