TOPIC

100% wrong pls can some one point out my mistake

nameless55 asked 2 months ago

def negetive_zero(x):
    p = list(x)
    if p[0]=='-':
        return True
    else:
        return False
def zero(x):
    h = list(x)
    if h[1]=='0':
        return True
    else:
        return False

first = list(map(float, input().split()))
second = list(map(float, input().split()))
a = first[0]
b = first[1]
c = second[0]
d = second[1]

print("A = %.6f, B = %.6f" %(a,b))
print("C = %.6f, D = %.6f" %(c,d))

print("A = %.1f, B = %.1f" %(a,b))
print("C = %.1f, D = %.1f" %(c,d))

print("A = %.2f, B = %.2f" %(a,b))
print("C = %.2f, D = %.2f" %(c,d))

print("A = %.3f, B = %.3f" %(a,b))
print("C = %.3f, D = %.3f" %(c,d))

print("A = %.3E, B = %.3E" %(a,b))
print("C = %.3E, D = %.3E" %(c,d))

if negetive_zero(str(a))==True and zero(str(a))==True:
    a = '-0'
else:
    a = round(a)
if negetive_zero(str(b))==True and zero(str(b))==True:
    b = '-0'
else:
    b = round(b)
if negetive_zero(str(c))==True and zero(str(c))==True:
    c = '-0'
else:
    c = round(c)
if negetive_zero(str(d))==True and zero(str(d))==True:
    d = '-0'
else:
    d = round(d)
print("A = {A}, B = {B}".format(A=a,B=b))
print("C = {C}, D = {D}".format(C=c,D=d))

This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.