diff --git a/python/jupyter/01 Your first program in Python.ipynb b/python/jupyter/01 Your first program in Python.ipynb index 73d22b7c..a4a2625b 100644 --- a/python/jupyter/01 Your first program in Python.ipynb +++ b/python/jupyter/01 Your first program in Python.ipynb @@ -709,6 +709,66 @@ "max('codebar','is','great')" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "You weren't expected this result? On `string` the default order is the alphabetical order like in a normal dictionnary. In the alphabetical order `'codebar'` is before `'great'` which is before `'is'`. That's why `'is'` is the *bigger* one.\n", + "Play with the following examples to see how uppercase letter and special characters are ordered." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "max('space','space ')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "max('dot','dot.')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "max('dot and space ','dot and space.')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "max('U','u')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "max('o','รถ')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The thing to remember here is that there `string` can be ordered. " + ] + }, { "cell_type": "markdown", "metadata": {},