Calculate speed , distance and time | Function to calculate speed ; Function to calculate distance traveled ; Function to calculate time taken ; Calling function cal_speed ( ) ; Calling function cal_dis ( ) ; Calling function cal_time ( )
def cal_speed ( dist , time ) : NEW_LINE INDENT print ( " ▁ Distance ( km ) ▁ : " , dist ) ; NEW_LINE print ( " ▁ Time ( hr ) ▁ : " , time ) ; NEW_LINE return dist / time ; NEW_LINE DEDENT def cal_dis ( speed , time ) : NEW_LINE INDENT print ( " ▁ Time ( hr ) ▁ : " , time ) ; NEW_LINE print ( " ▁ Speed ( km ▁ / ▁ hr ) ▁ : " , speed ) ; NEW_LINE return speed * time ; NEW_LINE DEDENT def cal_time ( dist , speed ) : NEW_LINE INDENT print ( " ▁ Distance ( km ) ▁ : " , dist ) ; NEW_LINE print ( " ▁ Speed ( km ▁ / ▁ hr ) ▁ : " , speed ) ; NEW_LINE return speed * dist ; NEW_LINE DEDENT print ( " ▁ The ▁ calculated ▁ Speed ( km ▁ / ▁ hr ) ▁ is ▁ : " , cal_speed ( 45.9 , 2.0 ) ) ; NEW_LINE print ( " " ) ; NEW_LINE print ( " ▁ The ▁ calculated ▁ Distance ( km ) ▁ : " , cal_dis ( 62.9 , 2.5 ) ) ; NEW_LINE print ( " " ) ; NEW_LINE print ( " ▁ The ▁ calculated ▁ Time ( hr ) ▁ : " , cal_time ( 48.0 , 4.5 ) ) ; NEW_LINE