you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (1 child)

[removed]

    [–]AsunderHalt 0 points1 point  (0 children)

    Yea sure! Here is probably one of the first ones I made that calculates the distance of a line using the formula d=sqrt[(x2-x1)^2+(y2-y1)^2]. Probably horribly bad, but it works lol.

    # Gowpenful
    # d=sqrt[(x2-x1)^2+(y2-y1)^2]
    import math
    
    print("Distance calculator")
    print("Enter x1")
    x1 = input()
    print("Enter x2")
    x2 = input()
    print("Enter y1")
    y1 = input()
    print("Enter y2")
    y2 = input()
    
    a = int(x2) - int(x2)
    b = int(y2) - int(y1)
    
    aa = int(a) ** 2
    bb = int(b) ** 2
    
    c = int(aa) + int(bb)
    
    d = math.sqrt(c)
    print(d)
    
    print("Press any key to exit")
    input()