[ edit ]

# ===== 関数定義: 2点間の距離 =====
def distance( p1, p2 ):
    ( x1, y1 ) = p1
    ( x2, y2 ) = p2
    d = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
    return( d )

# ===== 関数定義: 2次元座標の入力を受け付けます =====
def input_point( message ):
    data_str = input( message )
    [x_str, y_str] = data_str.split( "," )
    p = ( float(x_str), float(y_str) )
    return( p )

SoftEng: Python/Prog/Example/04/Ex_003a/Digest (last edited 2018-10-29 16:15:55 by TadashiIijima)