Commit c6e507dd authored by pattaraporn's avatar pattaraporn

ส่งงานค่ะ

parent 6b1e8c31
def value(v,p,n):
sign = -1 if v[0] == 1 else 1
return sign*sum([v[i]*2**(p-i)for i in range(1,p+n+1)])
def values(V,p,n):
v=list(map(int,V))
sign = -1 if v[0] == 1 else 1
return sign*sum([v[i]*2**(p-i)for i in range(1,p+n+1)])
\ No newline at end of file
def value(v,p=4,n=3):
sign = -1 if v[0] == 1 else 1
return sign * sum([v[i] * (2 ** (p - i)) for i in range(1, p+n+1)])
def values(V,p=4,n=3):
v = list(map(int,V))
sign = -1 if v[0] == 1 else 1
return sign * sum([v[i] * (2 ** (p - i)) for i in range(1, p + n + 1)])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment