Python
Python
org/try-jupyter/lab/
https://colab.research.google.com/notebooks/basic_features_overview.ipynb
https://colab.research.google.com/drive/1KUoN0M7yQEhKsc9DGgn4RzUsCyFVEytB#scrollTo=MlvwONsCWp9p
https://colab.research.google.com/github/googlecolab/colabtools/blob/main/notebooks/colab-github-demo.ipynb
Old string formatting (Optional)
The format() method was introduced in Python 2.6. Before that, the % (modulo) operator could be
used to get a similar result. Although this method is no longer recommended for new code, you might
come across it in someone else's code. This is what it looks like:
The % (modulo) operator returns a copy of the string where the placeholders indicated by % followed
by a formatting expression are replaced by the variables after the operator.
To replace more than one value, you need to supply the values as a tuple. The formatting expression
must match the value type.
Variables can also be replaced by name using a dictionary syntax (you’ll learn about dictionaries in an
upcoming video).
The formatting expressions are mostly the same as those of the format() method.