<jupyter_start><jupyter_text>Custom librariesWhen programming python for some time, you may be using again and again the same code. You could copy&paste it from jupyter notebook to jupyter notebook. However, notebooks are not meant to hold many functions. Notebooks are meant to show short and concise examples of code. Thus, in order to organize our code, we can put function we use more often into a python file, a custom library, and then import the functions.See also:* [The import system](https://docs.python.org/3/reference/import.html)Within the same folder, there exists a [my_library.py](my_library.py) file. It contains two functions. Let's import them and use them:<jupyter_code>from my_library import square
square(5)
from my_library import *
wuzzle(5)<jupyter_output><empty_output><jupyter_text>When maintaining your own library of functions, make sure that the functions have reasonable names and useful docstrings. You may otherwise be confused about your own code later on.This is a good example:<jupyter_code>print(square.__doc__)<jupyter_output>Squares a number by multiplying it with itself  and returns its result.<jupyter_text>This is a bad example:<jupyter_code>print(wuzzle.__doc__)<jupyter_output>The wuzzle function manipulates a number in a magic way and returns the result.<jupyter_text>Modifying code in custom librariesIf you modify code in a python library file side-by-side with the code in a notebook, you may have restart your notebook after modifying the library file. You can do this in the menu `Kernel > Restart & Run All`.  ExerciseCreate an own library and write a function that can compute the [Euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance) between two points. The point coordinates are given as tuples. Hint: You will need a for-loop in this function that iterates pair-wise over the two coordinates:<jupyter_code>p = (1.5, 6.4, 7.3)
q = (3.4, 1.0, 0.9)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.06570841889117043, 'fraction_numerical': 0.0077002053388090345, 'mean_word_length': 5.453642384105961, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 16, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '530868', 'license': 'CC-BY-4.0', 'n_tokens_mistral': 558, 'n_tokens_neox': 535, 'n_words': 252, 'path': 'docs/03_advanced_python/custom_libraries.ipynb', 'repo_name': 'zoccoler/BioImageAnalysisNotebooks', 'size': '1948'}