Another example from "Python for Bioinformatics" by Sebastian Bassi: given a peptide sequence, we compute its approximate charge and the proportion of charged residues and return both as a tuple. This is a very Pythonic way of returning multiple values from a function; it is also very convenient, as the calling code can unpack the tuple on the fly. Check out the notebook linked below for more information on functions in Python.
Embedded video, part of the following course:
Coding for Scientists at Queen Mary, University of London
Jupyter notebook: https://tinyurl.com/5hav5u8m
Notebooks will open on Google Colab - no installation required
Watch video Returning multiple values from a Python function using tuples: more on the protein charge function online without registration, duration hours minute second in high quality. This video was added by user PatchyPython 11 October 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 28 once and liked it 0 people.