diff --git "a/101-Python345円205円245円351円227円250円-344円271円240円351円242円230円.ipynb" "b/101-Python345円205円245円351円227円250円-344円271円240円351円242円230円.ipynb" new file mode 100644 index 0000000..743fb62 --- /dev/null +++ "b/101-Python345円205円245円351円227円250円-344円271円240円351円242円230円.ipynb" @@ -0,0 +1,9298 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "# 基础环境准备" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "在python console中计算1+3+5+7+9。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "建立xxx.py文件,内容如课上所说。成功执行xxx.py,并得到正确结果。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "# Python基本语法" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "不借助python,说出以下输入的对应输出。再回到python console中检验是否正确。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "5432E1" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "54320.0" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "5432E1" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "'5432E1'" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "'5432E1'" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "'5432E1'" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "'''5432E1'''" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "'5432E1'" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "'''5432E1'''" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "\"5432E1'" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "ename": "SyntaxError", + "evalue": "EOL while scanning string literal (, line 2)", + "output_type": "error", + "traceback": [ + "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m2\u001b[0m\n\u001b[0;31m \"5432E1'\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m EOL while scanning string literal\n" + ] + } + ], + "source": [ + "# 能说出是错误即可,不必细究错误类型。\n", + "\"5432E1'" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "0E12345 == False" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "0E12345 == False" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "0E12345 == none" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'none' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;31m# 能说出是错误即可,不必细究错误类型。\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0;36m0E12345\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mnone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mNameError\u001b[0m: name 'none' is not defined" + ] + } + ], + "source": [ + "# 能说出是错误即可,不必细究错误类型。\n", + "0E12345 == none" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "把下面一段文字转换成python中的字符串表示。要求使用print输出后和原始文字一致。首尾的空白字符可视为无影响。\n", + "\n", + " You can specify multi-line strings using triple quotes - (\"\"\" or '''). You can use single quotes and double quotes freely within the triple quotes. An example is:" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "You can specify multi-line strings using triple quotes - (\"\"\" or '''). You can use single quotes and double quotes freely within the triple quotes. An example is:\n" + ] + } + ], + "source": [ + "# 最简答案如下。任何答案输出和原始一致都可。\n", + "print('''You can specify multi-line strings using triple quotes - (\"\"\" or \\''').\\\n", + " You can use single quotes and double quotes freely within the triple quotes. An example is:''')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "把下面一段文字转换成python中的字符串表示。要求使用print输出后和原始文字一致。首尾的空白字符可视为无影响。\n", + "\n", + " legal_chars is [abcdefghijklmnopqrstuvwxyz0123456789!\\#\\$%\\&'\\*\\+\\-\\.\\^_`\\|\\~:]+" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "legalchars is [abcdefghijklmnopqrstuvwxyz0123456789!#$%\\&'*+-.\\^`|~:]+\n" + ] + } + ], + "source": [ + "# 最简答案如下。任何答案输出和原始一致都可。\n", + "print('''legalchars is [abcdefghijklmnopqrstuvwxyz0123456789!#$%\\&'*+-.\\^`|~:]+''')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "# 算符和表达式" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "用括号为以下表达式指明求值顺序。\n", + "\n", + " user[lowbound>>1 or 0:highbound>>1]" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1]\n", + "[1]\n" + ] + } + ], + "source": [ + "user = [1, 2, 3]\n", + "lowbound = 1\n", + "highbound = 2\n", + "print(user[lowbound>>1 or 0:highbound>>1])\n", + "print(user[((lowbound>>1) or 0):(highbound>>1)])" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "用括号为以下表达式指明求值顺序。\n", + "\n", + " i+j&i-j^j+k&j-k" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "6\n", + "6\n" + ] + } + ], + "source": [ + "i,j,k=1,2,3\n", + "print(i+j&i-j^j+k&j-k)\n", + "print(((i+j)&(i-j))^((j+k)&(j-k)))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "试着用格式化输出以下字符串,原始字符串中不得出现username和shell。\n", + "\n", + " When you try to use variable in string, always wrap it with {}. For example, if you want to print 'my username is \"somebody\"'. You should use 'my username is {username}' as unformatted template. Format it with username equals to shell, it will generate 'my username is shell' as result." + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "scrolled": false, + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "When you try to use variable in string, always wrap it with {}. For example, if you want to print 'my username is \"somebody\"'. You should use 'my username is {username}' as unformatted template. Format it with username equals to shell, it will generate 'my username is shell' as result.\n", + "When you try to use variable in string, always wrap it with {}. For example, if you want to print 'my username is \"somebody\"'. You should use 'my username is {username}' as unformatted template. Format it with username equals to shell, it will generate 'my username is shell' as result.\n" + ] + } + ], + "source": [ + "print('''When you try to use variable in string, always wrap it with {}.\\\n", + " For example, if you want to print 'my username is \"somebody\"'.\\\n", + " You should use 'my username is {username}' as unformatted template.\\\n", + " Format it with username equals to shell, it will generate 'my username is shell' as result.''')\n", + "\n", + "print('''When you try to use variable in string, always wrap it with {}.\\\n", + " For example, if you want to print 'my %s is \"somebody\"'.\\\n", + " You should use 'my %s is {%s}' as unformatted template.\\\n", + " Format it with %s equals to %s, it will generate 'my %s is %s' as result.'''\n", + " % ('username', 'username', 'username', 'username', 'shell', 'username', 'shell'))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "python有两种format方式,使用另一种format方式完成上一题。" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "When you try to use variable in string, always wrap it with {}. For example, if you want to print 'my username is \"somebody\"'. You should use 'my username is {username}' as unformatted template. Format it with username equals to shell, it will generate 'my username is shell' as result.\n", + "When you try to use variable in string, always wrap it with {}. For example, if you want to print 'my username is \"somebody\"'. You should use 'my username is {username}' as unformatted template. Format it with username equals to shell, it will generate 'my username is shell' as result.\n" + ] + } + ], + "source": [ + "print('''When you try to use variable in string, always wrap it with {}.\\\n", + " For example, if you want to print 'my username is \"somebody\"'.\\\n", + " You should use 'my username is {username}' as unformatted template.\\\n", + " Format it with username equals to shell, it will generate 'my username is shell' as result.''')\n", + "\n", + "print('''When you try to use variable in string, always wrap it with {{}}.\\\n", + " For example, if you want to print 'my {variable} is \"somebody\"'.\\\n", + " You should use 'my {variable} is {{{variable}}}' as unformatted template.\\\n", + " Format it with {variable} equals to {username}, it will generate 'my {variable} is {username}' as result.'''.format(\n", + " variable='username', username='shell'))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "以下一段内容为2018年政府工作报告英文版。\n", + "\n", + "Over past five years, China' s gross domestic product (GDP) has risen from 54 trillion to 82.7 trillion yuan, registering average annual growth of 7.1 percent. More than 68 million people have been lifted out of poverty.\n", + "\n", + "下面有一系列变量,代表原始数据。请适当的设计格式化代码,输出和上文类似的文本。并在原始数据发生变更时,输出文本会自动做相应变化。\n", + "\n", + " prior_gdp = 5.4E13\n", + " current_gdp = 8.2700012E13\n", + " out_of_poverty = 6.8E7\n", + "\n", + "tips: 增长率在数据中没有,需要用两个gdp的比值,基于指数公式自行计算。计算结果和7.1并不一致,可以忽略。" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "over past five years, China' s gross domestic product (GDP) has risen from 54 trillion to 82.7 trillion yuan, registering average annual growth of 8.9 percent. More than 68 million people have been lifted out of poverty.\n" + ] + } + ], + "source": [ + "prior_gdp = 5.4E13\n", + "current_gdp = 8.2700012E13\n", + "out_of_poverty = 6.8E7\n", + "\n", + "print('''Over past five years, China' s gross domestic product (GDP) has risen from %d trillion to %.1f trillion yuan,\\\n", + " registering average annual growth of %.1f percent. More than %d million people have been lifted out of poverty.'''\n", + " % (prior_gdp/10**12, current_gdp/10**12, ((current_gdp/prior_gdp)**.2-1)*100, out_of_poverty/10**6))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "python有两种format方式,使用另一种format方式完成上一题。" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "over past five years, China' s gross domestic product (GDP) has risen from 54 trillion to 82.7 trillion yuan, registering average annual growth of 8.9 percent. More than 68 million people have been lifted out of poverty.\n" + ] + } + ], + "source": [ + "prior_gdp = 5.4E13\n", + "current_gdp = 8.2700012E13\n", + "out_of_poverty = 6.8E7\n", + "\n", + "print('''over past five years, China' s gross domestic product (GDP) has risen from {:d} trillion to {:.1f} trillion yuan,\\\n", + " registering average annual growth of {:.1f} percent. More than {:d} million people have been lifted out of poverty.'''\\\n", + " .format(int(prior_gdp/10**12), current_gdp/10**12, ((current_gdp/prior_gdp)**.2-1)*100, int(out_of_poverty/10**6)))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "试着写一段代码,打印自身。不得读取自身所在的python文件并打印。" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "s='s=%r;print(s%%s)';print(s%s)\n" + ] + } + ], + "source": [ + "# 任何能够通过测试的代码都行,以下是我所知的最简答案。\n", + "# that's called [quine](https://en.wikipedia.org/wiki/Quine_(computing))\n", + "s='s=%r;print(s%%s)';print(s%s)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "# 执行流控制" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "有一个数n,请判断这个数是否可以被3整除。\n", + "\n", + "输入:当前环境中存在变量n。`02:\n", + " a, b, n = a+b, a, n-1\n", + "print(a)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "[Euclidean algorithm](https://en.wikipedia.org/wiki/Euclidean_algorithm)是求解最大公约数问题([Greatest common divisor](https://en.wikipedia.org/wiki/Greatest_common_divisor))的有效方法。其基本思路为。\n", + "\n", + " gcd(a, b) = gcd(b, a mod b)\n", + "\n", + "请写出gcd算法,计算任意两个正整数的最大公约数。\n", + "\n", + "输入:当前环境中存在变量a, b,两者均满足`0=b。\n", + "\n", + "输出:打印gcd(a, b)" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "21\n" + ] + } + ], + "source": [ + "a, b = 1071, 462\n", + "\n", + "while b != 0:\n", + " a, b = b, a%b\n", + "print(a)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "# 函数" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "将上面的Fibonacci sequence计算过程封装为函数。\n", + "\n", + "输入:n。`02:\n", + " a, b, n = a+b, a, n-1\n", + " return a\n", + "\n", + "print(fib(10**2))\n", + "%time fib(30)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "用递归实现Fibonacci sequence,并比较效率。" + ] + }, + { + "cell_type": "code", + "execution_count": 141, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "CPU times: user 160 ms, sys: 4 ms, total: 164 ms\n", + "Wall time: 164 ms\n" + ] + }, + { + "data": { + "text/plain": [ + "832040" + ] + }, + "execution_count": 141, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "def fib(n):\n", + " if n <= 2:\n", + " return 1\n", + " return fib(n-1) + fib(n-2)\n", + "\n", + "%time fib(30)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "计算Fibonacci sequence迭代模式和递归模式的时间复杂度。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "source": [ + "* 迭代模式:`O(n)`\n", + "* 递归模式:`O(e^n)` (更精确的说,是`(1+sqrt(5))/2`的n次方)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "矩阵法计算Fibonacci sequence。" + ] + }, + { + "cell_type": "code", + "execution_count": 145, + "metadata": { + "collapsed": true, + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [], + "source": [ + "# TODO:" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "递归法求解Towers of Hanoi问题" + ] + }, + { + "cell_type": "code", + "execution_count": 146, + "metadata": { + "collapsed": true, + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [], + "source": [ + "# TODO:" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "将上面Euclidean algorithm计算过程封装为函数。\n", + "\n", + "输入:a, b,两者均满足`0=b。\n", + "\n", + "输出:gcd(a, b)。" + ] + }, + { + "cell_type": "code", + "execution_count": 143, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "21\n", + "The slowest run took 11.55 times longer than the fastest. This could mean that an intermediate result is being cached.\n", + "1000000 loops, best of 3: 293 ns per loop\n" + ] + } + ], + "source": [ + "def gcd(a, b):\n", + " while b != 0:\n", + " a, b = b, a%b\n", + " return a\n", + "\n", + "print(gcd(1071, 462))\n", + "%timeit gcd(1071, 462)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "将Euclidean algorithm计算过程改为递归,并计算效率。" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "21\n", + "The slowest run took 6.69 times longer than the fastest. This could mean that an intermediate result is being cached.\n", + "1000000 loops, best of 3: 459 ns per loop\n" + ] + } + ], + "source": [ + "def gcd(a, b):\n", + " if b == 0:\n", + " return a\n", + " return gcd(b, a%b)\n", + "\n", + "print(gcd(1071, 462))\n", + "%timeit gcd(1071, 462)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "分析Euclidean algorithm递归和迭代模式的时间和空间复杂度,并和Fibonacci sequence比较。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "source": [ + "迭代:\n", + "\n", + "* 时间复杂度:`O(log(a))`\n", + "* 空间复杂度:`O(1)`\n", + "\n", + "递归:\n", + "\n", + "* 时间复杂度:`O(log(a))`\n", + "* 空间复杂度:`O(log(a))`" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "不定方程(又称[丢番图方程](https://zh.wikipedia.org/wiki/%E4%B8%9F%E7%95%AA%E5%9C%96%E6%96%B9%E7%A8%8B),[Indeterminate equation](https://en.wikipedia.org/wiki/Indeterminate_equation))是未知数只能使用整数的多项式方程,其中形如`a1*x1+a2*x2+...+an*xn=c`的方程,称为一次不定方程。一次不定方程有整数解的充要条件为:\n", + "\n", + " c mod gcd(a1,a2,...,an) = 0\n", + "\n", + "我国数学家很早就开始研究一次不定方程。古代数学家张丘建在《张丘建算经》一书中提出了"百鸡问题":鸡翁一,值钱五,鸡母一,值钱三,鸡雏三,值钱一。百钱买百鸡,问鸡翁、鸡母、鸡雏各几何?\n", + "\n", + "请判定百鸡问题是否可解。\n", + "\n", + "tips: 可利用上文的Euclidean algorithm。" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "True\n" + ] + } + ], + "source": [ + "# 百鸡问题的不定方程组为\n", + "# 5x+3y+z/3=100\n", + "# x+y+z=100\n", + "# 1式可变为z=300-15x-9y,代入2消去z后可得x+y+300-15x-9y=100,化简可得7x+4y=100\n", + "\n", + "print(100 % gcd(7, 4) == 0)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "[Extended Euclidean algorithm](https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm)是Euclidean algorithm的一个扩展,能够求出a, b最大公约数的同时,找到整数x, y,使其满足[Bézout's identity](https://en.wikipedia.org/wiki/B%C3%A9zout%27s_identity)。\n", + "\n", + " a*x+b*y=gcd(a,b)\n", + " \n", + "其基本思路如下:\n", + "\n", + "对于一般Euclidean algorithm,在求解gcd(a, b)时,倒数第三步应为`r(n-2)=r(n-1)*q(n)+gcd(a,b)`(见下表)。通过变形,这个式子可以变为`gcd(a,b)=r(n-2)-r(n-1)*q(n)`。注意这个式子具有`gcd(a,b)=Y*r(n-1)+X*r(n-2)`的特征。此处我们令`Y(n-1)=-q(n)`,`X(n-1)=1`,式子可表为`gcd(a,b)=Y(n-1)*r(n-1)+X(n-1)*r(n-2)`。\n", + "\n", + "而倒数第四步的式子应为`r(n-3)=r(n-2)*q(n-1)+r(n-1)`,变形可得`r(n-1)=r(n-3)-r(n-2)*q(n-1)`。代入前式可得\n", + "\n", + " gcd(a,b)=Y(n-1)*r(n-1)+X(n-1)*r(n-2)\n", + " =Y(n-1)*(r(n-3)-r(n-2)*q(n-1))+X(n-1)*r(n-2)\n", + " =(X(n-1)-Y(n-1)*q(n-1))*r(n-2)+Y(n-1)*r(n-3)\n", + "\n", + "此时我们令`Y(n-2)=X(n-1)-Y(n-1)*q(n-1)`,`X(n-2)=Y(n-1)`,这个式子同样具有`gcd(a,b)=Y*r(n-2)+X*r(n-3)`的特征。\n", + "\n", + "依此类推,可以得到`gcd=Y(0)r(0)+X(0)r(-1)`的式子。而我们知道,`r(0)=b`, `r(-1)=a`。因此Y(0)和X(0)即为Bézout's identity的一个特解。\n", + "\n", + "推算补全所有数字的话,可以得到计算表如下:\n", + "\n", + " a b Y X\n", + " a=b*q1+r1 a b X(1)-Y(1)*q(1) Y(1)\n", + " b=r1*q2+r2 b r1 X(2)-Y(2)*q(2) Y(2)\n", + " ...\n", + " r(n-3)=r(n-2)*q(n-1)+r(n-1) r(n-3) r(n-2) X(n-1)-Y(n-1)*q(n-1) Y(n-1)\n", + " r(n-2)=r(n-1)*q(n)+r(n) r(n-2) r(n-1) 0-1*q(n) 1\n", + " r(n-1)=r(n)*q(n)+r(n+1) r(n-1) r(n) 1 0\n", + " gcd(a,b) 0 0 1\n", + "\n", + "请实现扩展欧几里得算法,求出方程`7x+4y=1`的一个解。并做验算。\n", + "\n", + "输入:a, b。均满足a>0,且可以假定a>b。\n", + "\n", + "输出:x, y。满足`a*x+b*y=gcd(a,b)`" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "-1 2 1\n", + "1\n" + ] + } + ], + "source": [ + "# 来源[扩展欧几里得算法](https://zh.wikipedia.org/wiki/%E6%89%A9%E5%B1%95%E6%AC%A7%E5%87%A0%E9%87%8C%E5%BE%97%E7%AE%97%E6%B3%95)\n", + "def ext_euclid(a, b):\n", + " if b == 0:\n", + " return 1, 0, a\n", + " x, y, q = ext_euclid(b, a % b)\n", + " return y, (x - (a // b) * y), q\n", + "\n", + "x, y, q = ext_euclid(7, 4)\n", + "print(x, y, q)\n", + "print(7*x+4*y)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "对于一次不定方程`ax+by=c`,如x0,y0为其一个解,则方程的一切解都具有如下的形式。\n", + "\n", + " x = x0-(b/gcd(a,b))*t\n", + " y = y0+(a/gcd(a,b))*t\n", + " \n", + "其中t为整数。\n", + "\n", + "基于以上知识,给出百鸡问题的所有正整数解组,并且验算是否满足原始的百鸡问题。" + ] + }, + { + "cell_type": "code", + "execution_count": 101, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "12 4 84\n", + "8 11 81\n", + "4 18 78\n", + "0 25 75\n" + ] + } + ], + "source": [ + "# 首先需要解出系数a1, b1。实际由于可以直接看出gcd(7,4)=1,因此a1=7, b1=4\n", + "\n", + "# 上文给出了Bézout's identity:7x+4y=1的一个特解,x=-1,y=2。我们又知道百鸡问题满足可解条件100 mod gcd(7,4) = 0。\n", + "# 因此我们可以向两边乘以系数s = 100/gcd(7,4) = 100。得到7x+4y=100的一个特解,x0=-100,y0=200。\n", + "\n", + "# 同时,解需要满足正数要求,因此\n", + "# -100-4*t>=0 t<=-25\n", + "# 200+7*t>=0 t>=-200/7=-28.57>-29\n", + "\n", + "for t in range(-28,-24):\n", + " x, y = -100-4*t, 200+7*t\n", + " z = 300 - 15*x - 9*y\n", + " print(x, y, z)\n", + " # 验算\n", + " if 5*x + 3*y + int(z/3) != 100:\n", + " print('error')\n", + " if x + y + z != 100:\n", + " print('error')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "将百鸡问题推广到一般二元一次不定方程,形如`a1*x1+a2*x2=c`。判定其可解性,并求出`x1>=0`且`x2>=0`范围内所有可能解。\n", + "\n", + "输入:a1, a2, c。皆为正整数,取值范围`0= 0\n", + "# X2 + q2*t>= 0\n", + "# 并且q1 < 0, q2> 0\n", + "def solve(a1, a2, c):\n", + " X1, X2, g = ext_euclid(a1, a2)\n", + " if c % g != 0:\n", + " print('no result')\n", + " return\n", + " X1, X2 = X1*c/g, X2*c/g\n", + " print('one match: %d %d' % (X1, X2))\n", + " q1, q2 = -int(a2/g), int(a1/g)\n", + " for t in range(-int(X2/q2), -int(X1/q1)+1):\n", + " x1, x2 = X1 + q1*t, X2 + q2*t\n", + " print('rslt:', t, int(x1), int(x2))\n", + "\n", + "solve(7, 4, 100)" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "-1467859 351641 1\n", + "1610347517 9688640734\n", + "56070685437719104\n" + ] + } + ], + "source": [ + "X1, X2, g = ext_euclid(1333310, 5565651)\n", + "print(X1, X2, g)\n", + "import random\n", + "X1=random.randint(0, 10**10)\n", + "X2=random.randint(0, 10**10)\n", + "print('%d %d' % (X1, X2))\n", + "print(1333310*X1+5565651*X2)" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "one match: -82303860255924930215936 19716751898004984692736\n", + "rslt: 42043703296 0\n", + "rslt: 42043703296 0\n", + "rslt: 42043703296 4194304\n", + "rslt: 42026926080 4194304\n", + "rslt: 42026926080 4194304\n", + "rslt: 42026926080 8388608\n", + "rslt: 42026926080 8388608\n", + "rslt: 42010148864 8388608\n", + "rslt: 42010148864 12582912\n", + "rslt: 42010148864 12582912\n", + "rslt: 41993371648 12582912\n", + "rslt: 41993371648 16777216\n", + "rslt: 41993371648 16777216\n", + "rslt: 41976594432 16777216\n", + "rslt: 41976594432 20971520\n", + "rslt: 41976594432 20971520\n", + "rslt: 41959817216 20971520\n", + "rslt: 41959817216 25165824\n", + "rslt: 41959817216 25165824\n", + "rslt: 41943040000 25165824\n", + "rslt: 41943040000 29360128\n", + "rslt: 41943040000 29360128\n", + "rslt: 41926262784 29360128\n", + "rslt: 41926262784 29360128\n", + "rslt: 41926262784 33554432\n", + "rslt: 41909485568 33554432\n", + "rslt: 41909485568 33554432\n", + "rslt: 41909485568 37748736\n", + "rslt: 41892708352 37748736\n", + "rslt: 41892708352 37748736\n", + "rslt: 41892708352 41943040\n", + "rslt: 41875931136 41943040\n", + "rslt: 41875931136 41943040\n", + "rslt: 41875931136 46137344\n", + "rslt: 41859153920 46137344\n", + "rslt: 41859153920 46137344\n", + "rslt: 41859153920 50331648\n", + "rslt: 41842376704 50331648\n", + "rslt: 41842376704 50331648\n", + "rslt: 41842376704 54525952\n", + "rslt: 41825599488 54525952\n", + "rslt: 41825599488 54525952\n", + "rslt: 41825599488 58720256\n", + "rslt: 41808822272 58720256\n", + "rslt: 41808822272 58720256\n", + "rslt: 41808822272 58720256\n", + "rslt: 41792045056 62914560\n", + "rslt: 41792045056 62914560\n", + "rslt: 41792045056 62914560\n", + "rslt: 41775267840 67108864\n", + "rslt: 41775267840 67108864\n", + "rslt: 41775267840 67108864\n", + "rslt: 41758490624 71303168\n", + "rslt: 41758490624 71303168\n", + "rslt: 41758490624 71303168\n", + "rslt: 41741713408 75497472\n", + "rslt: 41741713408 75497472\n", + "rslt: 41741713408 75497472\n", + "rslt: 41724936192 79691776\n", + "rslt: 41724936192 79691776\n", + "rslt: 41724936192 79691776\n", + "rslt: 41708158976 83886080\n", + "rslt: 41708158976 83886080\n", + "rslt: 41708158976 83886080\n", + "rslt: 41691381760 88080384\n", + "rslt: 41691381760 88080384\n", + "rslt: 41691381760 88080384\n", + "rslt: 41674604544 88080384\n", + "rslt: 41674604544 92274688\n", + "rslt: 41674604544 92274688\n", + "rslt: 41657827328 92274688\n", + "rslt: 41657827328 96468992\n", + "rslt: 41657827328 96468992\n", + "rslt: 41641050112 96468992\n", + "rslt: 41641050112 100663296\n", + "rslt: 41641050112 100663296\n", + "rslt: 41624272896 100663296\n", + "rslt: 41624272896 104857600\n", + "rslt: 41624272896 104857600\n", + "rslt: 41607495680 104857600\n", + "rslt: 41607495680 109051904\n", + "rslt: 41607495680 109051904\n", + "rslt: 41590718464 109051904\n", + "rslt: 41590718464 113246208\n", + "rslt: 41590718464 113246208\n", + "rslt: 41573941248 113246208\n", + "rslt: 41573941248 117440512\n", + "rslt: 41573941248 117440512\n", + "rslt: 41557164032 117440512\n", + "rslt: 41557164032 117440512\n", + "rslt: 41557164032 121634816\n", + "rslt: 41540386816 121634816\n", + "rslt: 41540386816 121634816\n", + "rslt: 41540386816 125829120\n", + "rslt: 41523609600 125829120\n", + "rslt: 41523609600 125829120\n", + "rslt: 41523609600 130023424\n", + "rslt: 41506832384 130023424\n", + "rslt: 41506832384 130023424\n", + "rslt: 41506832384 134217728\n", + "rslt: 41490055168 134217728\n", + "rslt: 41490055168 134217728\n", + "rslt: 41490055168 138412032\n", + "rslt: 41473277952 138412032\n", + "rslt: 41473277952 138412032\n", + "rslt: 41473277952 142606336\n", + "rslt: 41456500736 142606336\n", + "rslt: 41456500736 142606336\n", + "rslt: 41456500736 146800640\n", + "rslt: 41439723520 146800640\n", + "rslt: 41439723520 146800640\n", + "rslt: 41439723520 146800640\n", + "rslt: 41422946304 150994944\n", + "rslt: 41422946304 150994944\n", + "rslt: 41422946304 150994944\n", + "rslt: 41406169088 155189248\n", + "rslt: 41406169088 155189248\n", + "rslt: 41406169088 155189248\n", + "rslt: 41389391872 159383552\n", + "rslt: 41389391872 159383552\n", + "rslt: 41389391872 159383552\n", + "rslt: 41372614656 163577856\n", + "rslt: 41372614656 163577856\n", + "rslt: 41372614656 163577856\n", + "rslt: 41355837440 167772160\n", + "rslt: 41355837440 167772160\n", + "rslt: 41355837440 167772160\n", + "rslt: 41339060224 171966464\n", + "rslt: 41339060224 171966464\n", + "rslt: 41339060224 171966464\n", + "rslt: 41322283008 171966464\n", + "rslt: 41322283008 176160768\n", + "rslt: 41322283008 176160768\n", + "rslt: 41305505792 176160768\n", + "rslt: 41305505792 180355072\n", + "rslt: 41305505792 180355072\n", + "rslt: 41288728576 180355072\n", + "rslt: 41288728576 184549376\n", + "rslt: 41288728576 184549376\n", + "rslt: 41271951360 184549376\n", + "rslt: 41271951360 188743680\n", + "rslt: 41271951360 188743680\n", + "rslt: 41255174144 188743680\n", + "rslt: 41255174144 192937984\n", + "rslt: 41255174144 192937984\n", + "rslt: 41238396928 192937984\n", + "rslt: 41238396928 197132288\n", + "rslt: 41238396928 197132288\n", + "rslt: 41221619712 197132288\n", + "rslt: 41221619712 201326592\n", + "rslt: 41221619712 201326592\n", + "rslt: 41204842496 201326592\n", + "rslt: 41204842496 201326592\n", + "rslt: 41204842496 205520896\n", + "rslt: 41188065280 205520896\n", + "rslt: 41188065280 205520896\n", + "rslt: 41188065280 209715200\n", + "rslt: 41171288064 209715200\n", + "rslt: 41171288064 209715200\n", + "rslt: 41171288064 213909504\n", + "rslt: 41154510848 213909504\n", + "rslt: 41154510848 213909504\n", + "rslt: 41154510848 218103808\n", + "rslt: 41137733632 218103808\n", + "rslt: 41137733632 218103808\n", + "rslt: 41137733632 222298112\n", + "rslt: 41120956416 222298112\n", + "rslt: 41120956416 222298112\n", + "rslt: 41120956416 226492416\n", + "rslt: 41104179200 226492416\n", + "rslt: 41104179200 226492416\n", + "rslt: 41104179200 230686720\n", + "rslt: 41087401984 230686720\n", + "rslt: 41087401984 230686720\n", + "rslt: 41087401984 230686720\n", + "rslt: 41070624768 234881024\n", + "rslt: 41070624768 234881024\n", + "rslt: 41070624768 234881024\n", + "rslt: 41053847552 239075328\n", + "rslt: 41053847552 239075328\n", + "rslt: 41053847552 239075328\n", + "rslt: 41037070336 243269632\n", + "rslt: 41037070336 243269632\n", + "rslt: 41037070336 243269632\n", + "rslt: 41020293120 247463936\n", + "rslt: 41020293120 247463936\n", + "rslt: 41020293120 247463936\n", + "rslt: 41003515904 251658240\n", + "rslt: 41003515904 251658240\n", + "rslt: 41003515904 251658240\n", + "rslt: 40986738688 255852544\n", + "rslt: 40986738688 255852544\n", + "rslt: 40986738688 255852544\n", + "rslt: 40969961472 260046848\n", + "rslt: 40969961472 260046848\n", + "rslt: 40969961472 260046848\n", + "rslt: 40953184256 260046848\n", + "rslt: 40953184256 264241152\n", + "rslt: 40953184256 264241152\n", + "rslt: 40936407040 264241152\n", + "rslt: 40936407040 268435456\n", + "rslt: 40936407040 268435456\n", + "rslt: 40919629824 268435456\n", + "rslt: 40919629824 272629760\n", + "rslt: 40919629824 272629760\n", + "rslt: 40902852608 272629760\n", + "rslt: 40902852608 276824064\n", + "rslt: 40902852608 276824064\n", + "rslt: 40886075392 276824064\n", + "rslt: 40886075392 281018368\n", + "rslt: 40886075392 281018368\n", + "rslt: 40869298176 281018368\n", + "rslt: 40869298176 285212672\n", + "rslt: 40869298176 285212672\n", + "rslt: 40869298176 285212672\n", + "rslt: 40852520960 289406976\n", + "rslt: 40852520960 289406976\n", + "rslt: 40852520960 289406976\n", + "rslt: 40835743744 289406976\n", + "rslt: 40835743744 293601280\n", + "rslt: 40835743744 293601280\n", + "rslt: 40818966528 293601280\n", + "rslt: 40818966528 297795584\n", + "rslt: 40818966528 297795584\n", + "rslt: 40802189312 297795584\n", + "rslt: 40802189312 301989888\n", + "rslt: 40802189312 301989888\n", + "rslt: 40785412096 301989888\n", + "rslt: 40785412096 306184192\n", + "rslt: 40785412096 306184192\n", + "rslt: 40768634880 306184192\n", + "rslt: 40768634880 310378496\n", + "rslt: 40768634880 310378496\n", + "rslt: 40751857664 310378496\n", + "rslt: 40751857664 314572800\n", + "rslt: 40751857664 314572800\n", + "rslt: 40735080448 314572800\n", + "rslt: 40735080448 318767104\n", + "rslt: 40735080448 318767104\n", + "rslt: 40718303232 318767104\n", + "rslt: 40718303232 318767104\n", + "rslt: 40718303232 322961408\n", + "rslt: 40701526016 322961408\n", + "rslt: 40701526016 322961408\n", + "rslt: 40701526016 327155712\n", + "rslt: 40684748800 327155712\n", + "rslt: 40684748800 327155712\n", + "rslt: 40684748800 331350016\n", + "rslt: 40667971584 331350016\n", + "rslt: 40667971584 331350016\n", + "rslt: 40667971584 335544320\n", + "rslt: 40651194368 335544320\n", + "rslt: 40651194368 335544320\n", + "rslt: 40651194368 339738624\n", + "rslt: 40634417152 339738624\n", + "rslt: 40634417152 339738624\n", + "rslt: 40634417152 343932928\n", + "rslt: 40617639936 343932928\n", + "rslt: 40617639936 343932928\n", + "rslt: 40617639936 348127232\n", + "rslt: 40600862720 348127232\n", + "rslt: 40600862720 348127232\n", + "rslt: 40600862720 348127232\n", + "rslt: 40584085504 352321536\n", + "rslt: 40584085504 352321536\n", + "rslt: 40584085504 352321536\n", + "rslt: 40567308288 356515840\n", + "rslt: 40567308288 356515840\n", + "rslt: 40567308288 356515840\n", + "rslt: 40550531072 360710144\n", + "rslt: 40550531072 360710144\n", + "rslt: 40550531072 360710144\n", + "rslt: 40533753856 364904448\n", + "rslt: 40533753856 364904448\n", + "rslt: 40533753856 364904448\n", + "rslt: 40516976640 369098752\n", + "rslt: 40516976640 369098752\n", + "rslt: 40516976640 369098752\n", + "rslt: 40500199424 373293056\n", + "rslt: 40500199424 373293056\n", + "rslt: 40500199424 373293056\n", + "rslt: 40483422208 373293056\n", + "rslt: 40483422208 377487360\n", + "rslt: 40483422208 377487360\n", + "rslt: 40466644992 377487360\n", + "rslt: 40466644992 381681664\n", + "rslt: 40466644992 381681664\n", + "rslt: 40449867776 381681664\n", + "rslt: 40449867776 385875968\n", + "rslt: 40449867776 385875968\n", + "rslt: 40433090560 385875968\n", + "rslt: 40433090560 390070272\n", + "rslt: 40433090560 390070272\n", + "rslt: 40416313344 390070272\n", + "rslt: 40416313344 394264576\n", + "rslt: 40416313344 394264576\n", + "rslt: 40399536128 394264576\n", + "rslt: 40399536128 398458880\n", + "rslt: 40399536128 398458880\n", + "rslt: 40382758912 398458880\n", + "rslt: 40382758912 402653184\n", + "rslt: 40382758912 402653184\n", + "rslt: 40365981696 402653184\n", + "rslt: 40365981696 402653184\n", + "rslt: 40365981696 406847488\n", + "rslt: 40349204480 406847488\n", + "rslt: 40349204480 406847488\n", + "rslt: 40349204480 411041792\n", + "rslt: 40332427264 411041792\n", + "rslt: 40332427264 411041792\n", + "rslt: 40332427264 415236096\n", + "rslt: 40315650048 415236096\n", + "rslt: 40315650048 415236096\n", + "rslt: 40315650048 419430400\n", + "rslt: 40298872832 419430400\n", + "rslt: 40298872832 419430400\n", + "rslt: 40298872832 423624704\n", + "rslt: 40282095616 423624704\n", + "rslt: 40282095616 423624704\n", + "rslt: 40282095616 427819008\n", + "rslt: 40265318400 427819008\n", + "rslt: 40265318400 427819008\n", + "rslt: 40265318400 432013312\n", + "rslt: 40248541184 432013312\n", + "rslt: 40248541184 432013312\n", + "rslt: 40248541184 432013312\n", + "rslt: 40231763968 436207616\n", + "rslt: 40231763968 436207616\n", + "rslt: 40231763968 436207616\n", + "rslt: 40214986752 440401920\n", + "rslt: 40214986752 440401920\n", + "rslt: 40214986752 440401920\n", + "rslt: 40198209536 444596224\n", + "rslt: 40198209536 444596224\n", + "rslt: 40198209536 444596224\n", + "rslt: 40181432320 448790528\n", + "rslt: 40181432320 448790528\n", + "rslt: 40181432320 448790528\n", + "rslt: 40164655104 452984832\n", + "rslt: 40164655104 452984832\n", + "rslt: 40164655104 452984832\n", + "rslt: 40147877888 457179136\n", + "rslt: 40147877888 457179136\n", + "rslt: 40147877888 457179136\n", + "rslt: 40131100672 461373440\n", + "rslt: 40131100672 461373440\n", + "rslt: 40131100672 461373440\n", + "rslt: 40114323456 461373440\n", + "rslt: 40114323456 465567744\n", + "rslt: 40114323456 465567744\n", + "rslt: 40097546240 465567744\n", + "rslt: 40097546240 469762048\n", + "rslt: 40097546240 469762048\n", + "rslt: 40080769024 469762048\n", + "rslt: 40080769024 473956352\n", + "rslt: 40080769024 473956352\n", + "rslt: 40063991808 473956352\n", + "rslt: 40063991808 478150656\n", + "rslt: 40063991808 478150656\n", + "rslt: 40047214592 478150656\n", + "rslt: 40047214592 482344960\n", + "rslt: 40047214592 482344960\n", + "rslt: 40030437376 482344960\n", + "rslt: 40030437376 486539264\n", + "rslt: 40030437376 486539264\n", + "rslt: 40013660160 486539264\n", + "rslt: 40013660160 490733568\n", + "rslt: 40013660160 490733568\n", + "rslt: 39996882944 490733568\n", + "rslt: 39996882944 490733568\n", + "rslt: 39996882944 494927872\n", + "rslt: 39980105728 494927872\n", + "rslt: 39980105728 494927872\n", + "rslt: 39980105728 499122176\n", + "rslt: 39963328512 499122176\n", + "rslt: 39963328512 499122176\n", + "rslt: 39963328512 503316480\n", + "rslt: 39946551296 503316480\n", + "rslt: 39946551296 503316480\n", + "rslt: 39946551296 507510784\n", + "rslt: 39929774080 507510784\n", + "rslt: 39929774080 507510784\n", + "rslt: 39929774080 511705088\n", + "rslt: 39912996864 511705088\n", + "rslt: 39912996864 511705088\n", + "rslt: 39912996864 515899392\n", + "rslt: 39896219648 515899392\n", + "rslt: 39896219648 515899392\n", + "rslt: 39896219648 520093696\n", + "rslt: 39879442432 520093696\n", + "rslt: 39879442432 520093696\n", + "rslt: 39879442432 520093696\n", + "rslt: 39862665216 524288000\n", + "rslt: 39862665216 524288000\n", + "rslt: 39862665216 524288000\n", + "rslt: 39845888000 528482304\n", + "rslt: 39845888000 528482304\n", + "rslt: 39845888000 528482304\n", + "rslt: 39829110784 532676608\n", + "rslt: 39829110784 532676608\n", + "rslt: 39829110784 532676608\n", + "rslt: 39812333568 536870912\n", + "rslt: 39812333568 536870912\n", + "rslt: 39812333568 536870912\n", + "rslt: 39795556352 541065216\n", + "rslt: 39795556352 541065216\n", + "rslt: 39795556352 541065216\n", + "rslt: 39778779136 545259520\n", + "rslt: 39778779136 545259520\n", + "rslt: 39778779136 545259520\n", + "rslt: 39762001920 549453824\n", + "rslt: 39762001920 549453824\n", + "rslt: 39762001920 549453824\n", + "rslt: 39745224704 549453824\n", + "rslt: 39745224704 553648128\n", + "rslt: 39745224704 553648128\n", + "rslt: 39728447488 553648128\n", + "rslt: 39728447488 557842432\n", + "rslt: 39728447488 557842432\n", + "rslt: 39711670272 557842432\n", + "rslt: 39711670272 562036736\n", + "rslt: 39711670272 562036736\n", + "rslt: 39711670272 562036736\n", + "rslt: 39694893056 566231040\n", + "rslt: 39694893056 566231040\n", + "rslt: 39694893056 566231040\n", + "rslt: 39678115840 570425344\n", + "rslt: 39678115840 570425344\n", + "rslt: 39678115840 570425344\n", + "rslt: 39661338624 574619648\n", + "rslt: 39661338624 574619648\n", + "rslt: 39661338624 574619648\n", + "rslt: 39644561408 574619648\n", + "rslt: 39644561408 578813952\n", + "rslt: 39644561408 578813952\n", + "rslt: 39627784192 578813952\n", + "rslt: 39627784192 583008256\n", + "rslt: 39627784192 583008256\n", + "rslt: 39611006976 583008256\n", + "rslt: 39611006976 587202560\n", + "rslt: 39611006976 587202560\n", + "rslt: 39594229760 587202560\n", + "rslt: 39594229760 591396864\n", + "rslt: 39594229760 591396864\n", + "rslt: 39577452544 591396864\n", + "rslt: 39577452544 595591168\n", + "rslt: 39577452544 595591168\n", + "rslt: 39560675328 595591168\n", + "rslt: 39560675328 599785472\n", + "rslt: 39560675328 599785472\n", + "rslt: 39543898112 599785472\n", + "rslt: 39543898112 603979776\n", + "rslt: 39543898112 603979776\n", + "rslt: 39527120896 603979776\n", + "rslt: 39527120896 603979776\n", + "rslt: 39527120896 608174080\n", + "rslt: 39510343680 608174080\n", + "rslt: 39510343680 608174080\n", + "rslt: 39510343680 612368384\n", + "rslt: 39493566464 612368384\n", + "rslt: 39493566464 612368384\n", + "rslt: 39493566464 616562688\n", + "rslt: 39476789248 616562688\n", + "rslt: 39476789248 616562688\n", + "rslt: 39476789248 620756992\n", + "rslt: 39460012032 620756992\n", + "rslt: 39460012032 620756992\n", + "rslt: 39460012032 624951296\n", + "rslt: 39443234816 624951296\n", + "rslt: 39443234816 624951296\n", + "rslt: 39443234816 629145600\n", + "rslt: 39426457600 629145600\n", + "rslt: 39426457600 629145600\n", + "rslt: 39426457600 633339904\n", + "rslt: 39409680384 633339904\n", + "rslt: 39409680384 633339904\n", + "rslt: 39409680384 633339904\n", + "rslt: 39392903168 637534208\n", + "rslt: 39392903168 637534208\n", + "rslt: 39392903168 637534208\n", + "rslt: 39376125952 641728512\n", + "rslt: 39376125952 641728512\n", + "rslt: 39376125952 641728512\n", + "rslt: 39359348736 645922816\n", + "rslt: 39359348736 645922816\n", + "rslt: 39359348736 645922816\n", + "rslt: 39342571520 650117120\n", + "rslt: 39342571520 650117120\n", + "rslt: 39342571520 650117120\n", + "rslt: 39325794304 654311424\n", + "rslt: 39325794304 654311424\n", + "rslt: 39325794304 654311424\n", + "rslt: 39309017088 658505728\n", + "rslt: 39309017088 658505728\n", + "rslt: 39309017088 658505728\n", + "rslt: 39292239872 662700032\n", + "rslt: 39292239872 662700032\n", + "rslt: 39292239872 662700032\n", + "rslt: 39275462656 662700032\n", + "rslt: 39275462656 666894336\n", + "rslt: 39275462656 666894336\n", + "rslt: 39258685440 666894336\n", + "rslt: 39258685440 671088640\n", + "rslt: 39258685440 671088640\n", + "rslt: 39241908224 671088640\n", + "rslt: 39241908224 675282944\n", + "rslt: 39241908224 675282944\n", + "rslt: 39225131008 675282944\n", + "rslt: 39225131008 679477248\n", + "rslt: 39225131008 679477248\n", + "rslt: 39208353792 679477248\n", + "rslt: 39208353792 683671552\n", + "rslt: 39208353792 683671552\n", + "rslt: 39191576576 683671552\n", + "rslt: 39191576576 687865856\n", + "rslt: 39191576576 687865856\n", + "rslt: 39174799360 687865856\n", + "rslt: 39174799360 692060160\n", + "rslt: 39174799360 692060160\n", + "rslt: 39158022144 692060160\n", + "rslt: 39158022144 692060160\n", + "rslt: 39158022144 696254464\n", + "rslt: 39141244928 696254464\n", + "rslt: 39141244928 696254464\n", + "rslt: 39141244928 700448768\n", + "rslt: 39124467712 700448768\n", + "rslt: 39124467712 700448768\n", + "rslt: 39124467712 704643072\n", + "rslt: 39107690496 704643072\n", + "rslt: 39107690496 704643072\n", + "rslt: 39107690496 708837376\n", + "rslt: 39090913280 708837376\n", + "rslt: 39090913280 708837376\n", + "rslt: 39090913280 713031680\n", + "rslt: 39074136064 713031680\n", + "rslt: 39074136064 713031680\n", + "rslt: 39074136064 717225984\n", + "rslt: 39057358848 717225984\n", + "rslt: 39057358848 717225984\n", + "rslt: 39057358848 721420288\n", + "rslt: 39040581632 721420288\n", + "rslt: 39040581632 721420288\n", + "rslt: 39040581632 721420288\n", + "rslt: 39023804416 725614592\n", + "rslt: 39023804416 725614592\n", + "rslt: 39023804416 725614592\n", + "rslt: 39007027200 729808896\n", + "rslt: 39007027200 729808896\n", + "rslt: 39007027200 729808896\n", + "rslt: 38990249984 734003200\n", + "rslt: 38990249984 734003200\n", + "rslt: 38990249984 734003200\n", + "rslt: 38973472768 738197504\n", + "rslt: 38973472768 738197504\n", + "rslt: 38973472768 738197504\n", + "rslt: 38956695552 742391808\n", + "rslt: 38956695552 742391808\n", + "rslt: 38956695552 742391808\n", + "rslt: 38939918336 746586112\n", + "rslt: 38939918336 746586112\n", + "rslt: 38939918336 746586112\n", + "rslt: 38923141120 750780416\n", + "rslt: 38923141120 750780416\n", + "rslt: 38923141120 750780416\n", + "rslt: 38906363904 750780416\n", + "rslt: 38906363904 754974720\n", + "rslt: 38906363904 754974720\n", + "rslt: 38889586688 754974720\n", + "rslt: 38889586688 759169024\n", + "rslt: 38889586688 759169024\n", + "rslt: 38872809472 759169024\n", + "rslt: 38872809472 763363328\n", + "rslt: 38872809472 763363328\n", + "rslt: 38856032256 763363328\n", + "rslt: 38856032256 767557632\n", + "rslt: 38856032256 767557632\n", + "rslt: 38839255040 767557632\n", + "rslt: 38839255040 771751936\n", + "rslt: 38839255040 771751936\n", + "rslt: 38822477824 771751936\n", + "rslt: 38822477824 775946240\n", + "rslt: 38822477824 775946240\n", + "rslt: 38805700608 775946240\n", + "rslt: 38805700608 775946240\n", + "rslt: 38805700608 780140544\n", + "rslt: 38788923392 780140544\n", + "rslt: 38788923392 780140544\n", + "rslt: 38788923392 784334848\n", + "rslt: 38772146176 784334848\n", + "rslt: 38772146176 784334848\n", + "rslt: 38772146176 788529152\n", + "rslt: 38755368960 788529152\n", + "rslt: 38755368960 788529152\n", + "rslt: 38755368960 792723456\n", + "rslt: 38738591744 792723456\n", + "rslt: 38738591744 792723456\n", + "rslt: 38738591744 796917760\n", + "rslt: 38721814528 796917760\n", + "rslt: 38721814528 796917760\n", + "rslt: 38721814528 801112064\n", + "rslt: 38705037312 801112064\n", + "rslt: 38705037312 801112064\n", + "rslt: 38705037312 805306368\n", + "rslt: 38688260096 805306368\n", + "rslt: 38688260096 805306368\n", + "rslt: 38688260096 805306368\n", + "rslt: 38671482880 809500672\n", + "rslt: 38671482880 809500672\n", + "rslt: 38671482880 809500672\n", + "rslt: 38654705664 813694976\n", + "rslt: 38654705664 813694976\n", + "rslt: 38654705664 813694976\n", + "rslt: 38637928448 817889280\n", + "rslt: 38637928448 817889280\n", + "rslt: 38637928448 817889280\n", + "rslt: 38621151232 822083584\n", + "rslt: 38621151232 822083584\n", + "rslt: 38621151232 822083584\n", + "rslt: 38604374016 826277888\n", + "rslt: 38604374016 826277888\n", + "rslt: 38604374016 826277888\n", + "rslt: 38587596800 830472192\n", + "rslt: 38587596800 830472192\n", + "rslt: 38587596800 830472192\n", + "rslt: 38570819584 834666496\n", + "rslt: 38570819584 834666496\n", + "rslt: 38570819584 834666496\n", + "rslt: 38554042368 834666496\n", + "rslt: 38554042368 838860800\n", + "rslt: 38554042368 838860800\n", + "rslt: 38537265152 838860800\n", + "rslt: 38537265152 843055104\n", + "rslt: 38537265152 843055104\n", + "rslt: 38537265152 843055104\n", + "rslt: 38520487936 847249408\n", + "rslt: 38520487936 847249408\n", + "rslt: 38520487936 847249408\n", + "rslt: 38503710720 851443712\n", + "rslt: 38503710720 851443712\n", + "rslt: 38503710720 851443712\n", + "rslt: 38486933504 855638016\n", + "rslt: 38486933504 855638016\n", + "rslt: 38486933504 855638016\n", + "rslt: 38470156288 859832320\n", + "rslt: 38470156288 859832320\n", + "rslt: 38470156288 859832320\n", + "rslt: 38453379072 864026624\n", + "rslt: 38453379072 864026624\n", + "rslt: 38453379072 864026624\n", + "rslt: 38436601856 864026624\n", + "rslt: 38436601856 868220928\n", + "rslt: 38436601856 868220928\n", + "rslt: 38419824640 868220928\n", + "rslt: 38419824640 872415232\n", + "rslt: 38419824640 872415232\n", + "rslt: 38403047424 872415232\n", + "rslt: 38403047424 876609536\n", + "rslt: 38403047424 876609536\n", + "rslt: 38386270208 876609536\n", + "rslt: 38386270208 880803840\n", + "rslt: 38386270208 880803840\n", + "rslt: 38369492992 880803840\n", + "rslt: 38369492992 884998144\n", + "rslt: 38369492992 884998144\n", + "rslt: 38352715776 884998144\n", + "rslt: 38352715776 889192448\n", + "rslt: 38352715776 889192448\n", + "rslt: 38335938560 889192448\n", + "rslt: 38335938560 893386752\n", + "rslt: 38335938560 893386752\n", + "rslt: 38319161344 893386752\n", + "rslt: 38319161344 893386752\n", + "rslt: 38319161344 897581056\n", + "rslt: 38302384128 897581056\n", + "rslt: 38302384128 897581056\n", + "rslt: 38302384128 901775360\n", + "rslt: 38285606912 901775360\n", + "rslt: 38285606912 901775360\n", + "rslt: 38285606912 905969664\n", + "rslt: 38268829696 905969664\n", + "rslt: 38268829696 905969664\n", + "rslt: 38268829696 910163968\n", + "rslt: 38252052480 910163968\n", + "rslt: 38252052480 910163968\n", + "rslt: 38252052480 914358272\n", + "rslt: 38235275264 914358272\n", + "rslt: 38235275264 914358272\n", + "rslt: 38235275264 918552576\n", + "rslt: 38218498048 918552576\n", + "rslt: 38218498048 918552576\n", + "rslt: 38218498048 922746880\n", + "rslt: 38201720832 922746880\n", + "rslt: 38201720832 922746880\n", + "rslt: 38201720832 922746880\n", + "rslt: 38184943616 926941184\n", + "rslt: 38184943616 926941184\n", + "rslt: 38184943616 926941184\n", + "rslt: 38168166400 931135488\n", + "rslt: 38168166400 931135488\n", + "rslt: 38168166400 931135488\n", + "rslt: 38151389184 935329792\n", + "rslt: 38151389184 935329792\n", + "rslt: 38151389184 935329792\n", + "rslt: 38134611968 939524096\n", + "rslt: 38134611968 939524096\n", + "rslt: 38134611968 939524096\n", + "rslt: 38117834752 943718400\n", + "rslt: 38117834752 943718400\n", + "rslt: 38117834752 943718400\n", + "rslt: 38101057536 947912704\n", + "rslt: 38101057536 947912704\n", + "rslt: 38101057536 947912704\n", + "rslt: 38084280320 952107008\n", + "rslt: 38084280320 952107008\n", + "rslt: 38084280320 952107008\n", + "rslt: 38067503104 952107008\n", + "rslt: 38067503104 956301312\n", + "rslt: 38067503104 956301312\n", + "rslt: 38050725888 956301312\n", + "rslt: 38050725888 960495616\n", + "rslt: 38050725888 960495616\n", + "rslt: 38033948672 960495616\n", + "rslt: 38033948672 964689920\n", + "rslt: 38033948672 964689920\n", + "rslt: 38017171456 964689920\n", + "rslt: 38017171456 968884224\n", + "rslt: 38017171456 968884224\n", + "rslt: 38000394240 968884224\n", + "rslt: 38000394240 973078528\n", + "rslt: 38000394240 973078528\n", + "rslt: 37983617024 973078528\n", + "rslt: 37983617024 977272832\n", + "rslt: 37983617024 977272832\n", + "rslt: 37966839808 977272832\n", + "rslt: 37966839808 977272832\n", + "rslt: 37966839808 981467136\n", + "rslt: 37950062592 981467136\n", + "rslt: 37950062592 981467136\n", + "rslt: 37950062592 985661440\n", + "rslt: 37933285376 985661440\n", + "rslt: 37933285376 985661440\n", + "rslt: 37933285376 989855744\n", + "rslt: 37916508160 989855744\n", + "rslt: 37916508160 989855744\n", + "rslt: 37916508160 994050048\n", + "rslt: 37899730944 994050048\n", + "rslt: 37899730944 994050048\n", + "rslt: 37899730944 998244352\n", + "rslt: 37882953728 998244352\n", + "rslt: 37882953728 998244352\n", + "rslt: 37882953728 1002438656\n", + "rslt: 37866176512 1002438656\n", + "rslt: 37866176512 1002438656\n", + "rslt: 37866176512 1006632960\n", + "rslt: 37849399296 1006632960\n", + "rslt: 37849399296 1006632960\n", + "rslt: 37849399296 1006632960\n", + "rslt: 37832622080 1010827264\n", + "rslt: 37832622080 1010827264\n", + "rslt: 37832622080 1010827264\n", + "rslt: 37815844864 1015021568\n", + "rslt: 37815844864 1015021568\n", + "rslt: 37815844864 1015021568\n", + "rslt: 37799067648 1019215872\n", + "rslt: 37799067648 1019215872\n", + "rslt: 37799067648 1019215872\n", + "rslt: 37782290432 1023410176\n", + "rslt: 37782290432 1023410176\n", + "rslt: 37782290432 1023410176\n", + "rslt: 37765513216 1027604480\n", + "rslt: 37765513216 1027604480\n", + "rslt: 37765513216 1027604480\n", + "rslt: 37748736000 1031798784\n", + "rslt: 37748736000 1031798784\n", + "rslt: 37748736000 1031798784\n", + "rslt: 37731958784 1035993088\n", + "rslt: 37731958784 1035993088\n", + "rslt: 37731958784 1035993088\n", + "rslt: 37715181568 1035993088\n", + "rslt: 37715181568 1040187392\n", + "rslt: 37715181568 1040187392\n", + "rslt: 37698404352 1040187392\n", + "rslt: 37698404352 1044381696\n", + "rslt: 37698404352 1044381696\n", + "rslt: 37681627136 1044381696\n", + "rslt: 37681627136 1048576000\n", + "rslt: 37681627136 1048576000\n", + "rslt: 37664849920 1048576000\n", + "rslt: 37664849920 1052770304\n", + "rslt: 37664849920 1052770304\n", + "rslt: 37648072704 1052770304\n", + "rslt: 37648072704 1056964608\n", + "rslt: 37648072704 1056964608\n", + "rslt: 37631295488 1056964608\n", + "rslt: 37631295488 1061158912\n", + "rslt: 37631295488 1061158912\n", + "rslt: 37614518272 1061158912\n", + "rslt: 37614518272 1065353216\n", + "rslt: 37614518272 1065353216\n", + "rslt: 37597741056 1065353216\n", + "rslt: 37597741056 1065353216\n", + "rslt: 37597741056 1069547520\n", + "rslt: 37580963840 1069547520\n", + "rslt: 37580963840 1069547520\n", + "rslt: 37580963840 1073741824\n", + "rslt: 37564186624 1073741824\n", + "rslt: 37564186624 1073741824\n", + "rslt: 37564186624 1077936128\n", + "rslt: 37547409408 1077936128\n", + "rslt: 37547409408 1077936128\n", + "rslt: 37547409408 1082130432\n", + "rslt: 37530632192 1082130432\n", + "rslt: 37530632192 1082130432\n", + "rslt: 37530632192 1086324736\n", + "rslt: 37513854976 1086324736\n", + "rslt: 37513854976 1086324736\n", + "rslt: 37513854976 1090519040\n", + "rslt: 37497077760 1090519040\n", + "rslt: 37497077760 1090519040\n", + "rslt: 37497077760 1094713344\n", + "rslt: 37480300544 1094713344\n", + "rslt: 37480300544 1094713344\n", + "rslt: 37480300544 1094713344\n", + "rslt: 37463523328 1098907648\n", + "rslt: 37463523328 1098907648\n", + "rslt: 37463523328 1098907648\n", + "rslt: 37446746112 1103101952\n", + "rslt: 37446746112 1103101952\n", + "rslt: 37446746112 1103101952\n", + "rslt: 37429968896 1107296256\n", + "rslt: 37429968896 1107296256\n", + "rslt: 37429968896 1107296256\n", + "rslt: 37413191680 1111490560\n", + "rslt: 37413191680 1111490560\n", + "rslt: 37413191680 1111490560\n", + "rslt: 37396414464 1115684864\n", + "rslt: 37396414464 1115684864\n", + "rslt: 37396414464 1115684864\n", + "rslt: 37379637248 1119879168\n", + "rslt: 37379637248 1119879168\n", + "rslt: 37379637248 1119879168\n", + "rslt: 37379637248 1124073472\n", + "rslt: 37362860032 1124073472\n", + "rslt: 37362860032 1124073472\n", + "rslt: 37362860032 1124073472\n", + "rslt: 37346082816 1128267776\n", + "rslt: 37346082816 1128267776\n", + "rslt: 37346082816 1128267776\n", + "rslt: 37329305600 1132462080\n", + "rslt: 37329305600 1132462080\n", + "rslt: 37329305600 1132462080\n", + "rslt: 37312528384 1136656384\n", + "rslt: 37312528384 1136656384\n", + "rslt: 37312528384 1136656384\n", + "rslt: 37295751168 1140850688\n", + "rslt: 37295751168 1140850688\n", + "rslt: 37295751168 1140850688\n", + "rslt: 37278973952 1145044992\n", + "rslt: 37278973952 1145044992\n", + "rslt: 37278973952 1145044992\n", + "rslt: 37262196736 1149239296\n", + "rslt: 37262196736 1149239296\n", + "rslt: 37262196736 1149239296\n", + "rslt: 37245419520 1153433600\n", + "rslt: 37245419520 1153433600\n", + "rslt: 37245419520 1153433600\n", + "rslt: 37228642304 1153433600\n", + "rslt: 37228642304 1157627904\n", + "rslt: 37228642304 1157627904\n", + "rslt: 37211865088 1157627904\n", + "rslt: 37211865088 1161822208\n", + "rslt: 37211865088 1161822208\n", + "rslt: 37195087872 1161822208\n", + "rslt: 37195087872 1166016512\n", + "rslt: 37195087872 1166016512\n", + "rslt: 37178310656 1166016512\n", + "rslt: 37178310656 1170210816\n", + "rslt: 37178310656 1170210816\n", + "rslt: 37161533440 1170210816\n", + "rslt: 37161533440 1174405120\n", + "rslt: 37161533440 1174405120\n", + "rslt: 37144756224 1174405120\n", + "rslt: 37144756224 1178599424\n", + "rslt: 37144756224 1178599424\n", + "rslt: 37127979008 1178599424\n", + "rslt: 37127979008 1182793728\n", + "rslt: 37127979008 1182793728\n", + "rslt: 37111201792 1182793728\n", + "rslt: 37111201792 1182793728\n", + "rslt: 37111201792 1186988032\n", + "rslt: 37094424576 1186988032\n", + "rslt: 37094424576 1186988032\n", + "rslt: 37094424576 1191182336\n", + "rslt: 37077647360 1191182336\n", + "rslt: 37077647360 1191182336\n", + "rslt: 37077647360 1195376640\n", + "rslt: 37060870144 1195376640\n", + "rslt: 37060870144 1195376640\n", + "rslt: 37060870144 1199570944\n", + "rslt: 37044092928 1199570944\n", + "rslt: 37044092928 1199570944\n", + "rslt: 37044092928 1203765248\n", + "rslt: 37027315712 1203765248\n", + "rslt: 37027315712 1203765248\n", + "rslt: 37027315712 1207959552\n", + "rslt: 37010538496 1207959552\n", + "rslt: 37010538496 1207959552\n", + "rslt: 37010538496 1207959552\n", + "rslt: 36993761280 1212153856\n", + "rslt: 36993761280 1212153856\n", + "rslt: 36993761280 1212153856\n", + "rslt: 36976984064 1216348160\n", + "rslt: 36976984064 1216348160\n", + "rslt: 36976984064 1216348160\n", + "rslt: 36960206848 1220542464\n", + "rslt: 36960206848 1220542464\n", + "rslt: 36960206848 1220542464\n", + "rslt: 36943429632 1224736768\n", + "rslt: 36943429632 1224736768\n", + "rslt: 36943429632 1224736768\n", + "rslt: 36926652416 1228931072\n", + "rslt: 36926652416 1228931072\n", + "rslt: 36926652416 1228931072\n", + "rslt: 36909875200 1233125376\n", + "rslt: 36909875200 1233125376\n", + "rslt: 36909875200 1233125376\n", + "rslt: 36893097984 1237319680\n", + "rslt: 36893097984 1237319680\n", + "rslt: 36893097984 1237319680\n", + "rslt: 36876320768 1237319680\n", + "rslt: 36876320768 1241513984\n", + "rslt: 36876320768 1241513984\n", + "rslt: 36859543552 1241513984\n", + "rslt: 36859543552 1245708288\n", + "rslt: 36859543552 1245708288\n", + "rslt: 36842766336 1245708288\n", + "rslt: 36842766336 1249902592\n", + "rslt: 36842766336 1249902592\n", + "rslt: 36825989120 1249902592\n", + "rslt: 36825989120 1254096896\n", + "rslt: 36825989120 1254096896\n", + "rslt: 36809211904 1254096896\n", + "rslt: 36809211904 1258291200\n", + "rslt: 36809211904 1258291200\n", + "rslt: 36792434688 1258291200\n", + "rslt: 36792434688 1262485504\n", + "rslt: 36792434688 1262485504\n", + "rslt: 36775657472 1262485504\n", + "rslt: 36775657472 1266679808\n", + "rslt: 36775657472 1266679808\n", + "rslt: 36758880256 1266679808\n", + "rslt: 36758880256 1266679808\n", + "rslt: 36758880256 1270874112\n", + "rslt: 36742103040 1270874112\n", + "rslt: 36742103040 1270874112\n", + "rslt: 36742103040 1275068416\n", + "rslt: 36725325824 1275068416\n", + "rslt: 36725325824 1275068416\n", + "rslt: 36725325824 1279262720\n", + "rslt: 36708548608 1279262720\n", + "rslt: 36708548608 1279262720\n", + "rslt: 36708548608 1283457024\n", + "rslt: 36691771392 1283457024\n", + "rslt: 36691771392 1283457024\n", + "rslt: 36691771392 1287651328\n", + "rslt: 36674994176 1287651328\n", + "rslt: 36674994176 1287651328\n", + "rslt: 36674994176 1291845632\n", + "rslt: 36658216960 1291845632\n", + "rslt: 36658216960 1291845632\n", + "rslt: 36658216960 1296039936\n", + "rslt: 36641439744 1296039936\n", + "rslt: 36641439744 1296039936\n", + "rslt: 36641439744 1296039936\n", + "rslt: 36624662528 1300234240\n", + "rslt: 36624662528 1300234240\n", + "rslt: 36624662528 1300234240\n", + "rslt: 36607885312 1304428544\n", + "rslt: 36607885312 1304428544\n", + "rslt: 36607885312 1304428544\n", + "rslt: 36591108096 1308622848\n", + "rslt: 36591108096 1308622848\n", + "rslt: 36591108096 1308622848\n", + "rslt: 36574330880 1312817152\n", + "rslt: 36574330880 1312817152\n", + "rslt: 36574330880 1312817152\n", + "rslt: 36557553664 1317011456\n", + "rslt: 36557553664 1317011456\n", + "rslt: 36557553664 1317011456\n", + "rslt: 36540776448 1321205760\n", + "rslt: 36540776448 1321205760\n", + "rslt: 36540776448 1321205760\n", + "rslt: 36523999232 1325400064\n", + "rslt: 36523999232 1325400064\n", + "rslt: 36523999232 1325400064\n", + "rslt: 36507222016 1325400064\n", + "rslt: 36507222016 1329594368\n", + "rslt: 36507222016 1329594368\n", + "rslt: 36490444800 1329594368\n", + "rslt: 36490444800 1333788672\n", + "rslt: 36490444800 1333788672\n", + "rslt: 36473667584 1333788672\n", + "rslt: 36473667584 1337982976\n", + "rslt: 36473667584 1337982976\n", + "rslt: 36456890368 1337982976\n", + "rslt: 36456890368 1342177280\n", + "rslt: 36456890368 1342177280\n", + "rslt: 36440113152 1342177280\n", + "rslt: 36440113152 1346371584\n", + "rslt: 36440113152 1346371584\n", + "rslt: 36423335936 1346371584\n", + "rslt: 36423335936 1350565888\n", + "rslt: 36423335936 1350565888\n", + "rslt: 36406558720 1350565888\n", + "rslt: 36406558720 1354760192\n", + "rslt: 36406558720 1354760192\n", + "rslt: 36389781504 1354760192\n", + "rslt: 36389781504 1354760192\n", + "rslt: 36389781504 1358954496\n", + "rslt: 36373004288 1358954496\n", + "rslt: 36373004288 1358954496\n", + "rslt: 36373004288 1363148800\n", + "rslt: 36356227072 1363148800\n", + "rslt: 36356227072 1363148800\n", + "rslt: 36356227072 1367343104\n", + "rslt: 36339449856 1367343104\n", + "rslt: 36339449856 1367343104\n", + "rslt: 36339449856 1371537408\n", + "rslt: 36322672640 1371537408\n", + "rslt: 36322672640 1371537408\n", + "rslt: 36322672640 1375731712\n", + "rslt: 36305895424 1375731712\n", + "rslt: 36305895424 1375731712\n", + "rslt: 36305895424 1379926016\n", + "rslt: 36289118208 1379926016\n", + "rslt: 36289118208 1379926016\n", + "rslt: 36289118208 1384120320\n", + "rslt: 36272340992 1384120320\n", + "rslt: 36272340992 1384120320\n", + "rslt: 36272340992 1384120320\n", + "rslt: 36255563776 1388314624\n", + "rslt: 36255563776 1388314624\n", + "rslt: 36255563776 1388314624\n", + "rslt: 36238786560 1392508928\n", + "rslt: 36238786560 1392508928\n", + "rslt: 36238786560 1392508928\n", + "rslt: 36222009344 1396703232\n", + "rslt: 36222009344 1396703232\n", + "rslt: 36222009344 1396703232\n", + "rslt: 36222009344 1400897536\n", + "rslt: 36205232128 1400897536\n", + "rslt: 36205232128 1400897536\n", + "rslt: 36205232128 1405091840\n", + "rslt: 36188454912 1405091840\n", + "rslt: 36188454912 1405091840\n", + "rslt: 36188454912 1409286144\n", + "rslt: 36171677696 1409286144\n", + "rslt: 36171677696 1409286144\n", + "rslt: 36171677696 1409286144\n", + "rslt: 36154900480 1413480448\n", + "rslt: 36154900480 1413480448\n", + "rslt: 36154900480 1413480448\n", + "rslt: 36138123264 1417674752\n", + "rslt: 36138123264 1417674752\n", + "rslt: 36138123264 1417674752\n", + "rslt: 36121346048 1421869056\n", + "rslt: 36121346048 1421869056\n", + "rslt: 36121346048 1421869056\n", + "rslt: 36104568832 1426063360\n", + "rslt: 36104568832 1426063360\n", + "rslt: 36104568832 1426063360\n", + "rslt: 36087791616 1430257664\n", + "rslt: 36087791616 1430257664\n", + "rslt: 36087791616 1430257664\n", + "rslt: 36071014400 1434451968\n", + "rslt: 36071014400 1434451968\n", + "rslt: 36071014400 1434451968\n", + "rslt: 36054237184 1438646272\n", + "rslt: 36054237184 1438646272\n", + "rslt: 36054237184 1438646272\n", + "rslt: 36037459968 1438646272\n", + "rslt: 36037459968 1442840576\n", + "rslt: 36037459968 1442840576\n", + "rslt: 36020682752 1442840576\n", + "rslt: 36020682752 1447034880\n", + "rslt: 36020682752 1447034880\n", + "rslt: 36003905536 1447034880\n", + "rslt: 36003905536 1451229184\n", + "rslt: 36003905536 1451229184\n", + "rslt: 35987128320 1451229184\n", + "rslt: 35987128320 1455423488\n", + "rslt: 35987128320 1455423488\n", + "rslt: 35970351104 1455423488\n", + "rslt: 35970351104 1459617792\n", + "rslt: 35970351104 1459617792\n", + "rslt: 35953573888 1459617792\n", + "rslt: 35953573888 1463812096\n", + "rslt: 35953573888 1463812096\n", + "rslt: 35936796672 1463812096\n", + "rslt: 35936796672 1468006400\n", + "rslt: 35936796672 1468006400\n", + "rslt: 35920019456 1468006400\n", + "rslt: 35920019456 1468006400\n", + "rslt: 35920019456 1472200704\n", + "rslt: 35903242240 1472200704\n", + "rslt: 35903242240 1472200704\n", + "rslt: 35903242240 1476395008\n", + "rslt: 35886465024 1476395008\n", + "rslt: 35886465024 1476395008\n", + "rslt: 35886465024 1480589312\n", + "rslt: 35869687808 1480589312\n", + "rslt: 35869687808 1480589312\n", + "rslt: 35869687808 1484783616\n", + "rslt: 35852910592 1484783616\n", + "rslt: 35852910592 1484783616\n", + "rslt: 35852910592 1488977920\n", + "rslt: 35836133376 1488977920\n", + "rslt: 35836133376 1488977920\n", + "rslt: 35836133376 1493172224\n", + "rslt: 35819356160 1493172224\n", + "rslt: 35819356160 1493172224\n", + "rslt: 35819356160 1497366528\n", + "rslt: 35802578944 1497366528\n", + "rslt: 35802578944 1497366528\n", + "rslt: 35802578944 1497366528\n", + "rslt: 35785801728 1501560832\n", + "rslt: 35785801728 1501560832\n", + "rslt: 35785801728 1501560832\n", + "rslt: 35769024512 1505755136\n", + "rslt: 35769024512 1505755136\n", + "rslt: 35769024512 1505755136\n", + "rslt: 35752247296 1509949440\n", + "rslt: 35752247296 1509949440\n", + "rslt: 35752247296 1509949440\n", + "rslt: 35735470080 1514143744\n", + "rslt: 35735470080 1514143744\n", + "rslt: 35735470080 1514143744\n", + "rslt: 35718692864 1518338048\n", + "rslt: 35718692864 1518338048\n", + "rslt: 35718692864 1518338048\n", + "rslt: 35701915648 1522532352\n", + "rslt: 35701915648 1522532352\n", + "rslt: 35701915648 1522532352\n", + "rslt: 35685138432 1526726656\n", + "rslt: 35685138432 1526726656\n", + "rslt: 35685138432 1526726656\n", + "rslt: 35668361216 1526726656\n", + "rslt: 35668361216 1530920960\n", + "rslt: 35668361216 1530920960\n", + "rslt: 35651584000 1530920960\n", + "rslt: 35651584000 1535115264\n", + "rslt: 35651584000 1535115264\n", + "rslt: 35634806784 1535115264\n", + "rslt: 35634806784 1539309568\n", + "rslt: 35634806784 1539309568\n", + "rslt: 35618029568 1539309568\n", + "rslt: 35618029568 1543503872\n", + "rslt: 35618029568 1543503872\n", + "rslt: 35601252352 1543503872\n", + "rslt: 35601252352 1547698176\n", + "rslt: 35601252352 1547698176\n", + "rslt: 35584475136 1547698176\n", + "rslt: 35584475136 1551892480\n", + "rslt: 35584475136 1551892480\n", + "rslt: 35567697920 1551892480\n", + "rslt: 35567697920 1556086784\n", + "rslt: 35567697920 1556086784\n", + "rslt: 35550920704 1556086784\n", + "rslt: 35550920704 1556086784\n", + "rslt: 35550920704 1560281088\n", + "rslt: 35534143488 1560281088\n", + "rslt: 35534143488 1560281088\n", + "rslt: 35534143488 1564475392\n", + "rslt: 35517366272 1564475392\n", + "rslt: 35517366272 1564475392\n", + "rslt: 35517366272 1568669696\n", + "rslt: 35500589056 1568669696\n", + "rslt: 35500589056 1568669696\n", + "rslt: 35500589056 1572864000\n", + "rslt: 35483811840 1572864000\n", + "rslt: 35483811840 1572864000\n", + "rslt: 35483811840 1577058304\n", + "rslt: 35467034624 1577058304\n", + "rslt: 35467034624 1577058304\n", + "rslt: 35467034624 1581252608\n", + "rslt: 35450257408 1581252608\n", + "rslt: 35450257408 1581252608\n", + "rslt: 35450257408 1585446912\n", + "rslt: 35433480192 1585446912\n", + "rslt: 35433480192 1585446912\n", + "rslt: 35433480192 1585446912\n", + "rslt: 35416702976 1589641216\n", + "rslt: 35416702976 1589641216\n", + "rslt: 35416702976 1589641216\n", + "rslt: 35399925760 1593835520\n", + "rslt: 35399925760 1593835520\n", + "rslt: 35399925760 1593835520\n", + "rslt: 35383148544 1598029824\n", + "rslt: 35383148544 1598029824\n", + "rslt: 35383148544 1598029824\n", + "rslt: 35366371328 1602224128\n", + "rslt: 35366371328 1602224128\n", + "rslt: 35366371328 1602224128\n", + "rslt: 35349594112 1606418432\n", + "rslt: 35349594112 1606418432\n", + "rslt: 35349594112 1606418432\n", + "rslt: 35332816896 1610612736\n", + "rslt: 35332816896 1610612736\n", + "rslt: 35332816896 1610612736\n", + "rslt: 35316039680 1610612736\n", + "rslt: 35316039680 1614807040\n", + "rslt: 35316039680 1614807040\n", + "rslt: 35299262464 1614807040\n", + "rslt: 35299262464 1619001344\n", + "rslt: 35299262464 1619001344\n", + "rslt: 35282485248 1619001344\n", + "rslt: 35282485248 1623195648\n", + "rslt: 35282485248 1623195648\n", + "rslt: 35265708032 1623195648\n", + "rslt: 35265708032 1627389952\n", + "rslt: 35265708032 1627389952\n", + "rslt: 35248930816 1627389952\n", + "rslt: 35248930816 1631584256\n", + "rslt: 35248930816 1631584256\n", + "rslt: 35232153600 1631584256\n", + "rslt: 35232153600 1635778560\n", + "rslt: 35232153600 1635778560\n", + "rslt: 35215376384 1635778560\n", + "rslt: 35215376384 1639972864\n", + "rslt: 35215376384 1639972864\n", + "rslt: 35198599168 1639972864\n", + "rslt: 35198599168 1639972864\n", + "rslt: 35198599168 1644167168\n", + "rslt: 35181821952 1644167168\n", + "rslt: 35181821952 1644167168\n", + "rslt: 35181821952 1648361472\n", + "rslt: 35165044736 1648361472\n", + "rslt: 35165044736 1648361472\n", + "rslt: 35165044736 1652555776\n", + "rslt: 35148267520 1652555776\n", + "rslt: 35148267520 1652555776\n", + "rslt: 35148267520 1656750080\n", + "rslt: 35131490304 1656750080\n", + "rslt: 35131490304 1656750080\n", + "rslt: 35131490304 1660944384\n", + "rslt: 35114713088 1660944384\n", + "rslt: 35114713088 1660944384\n", + "rslt: 35114713088 1665138688\n", + "rslt: 35097935872 1665138688\n", + "rslt: 35097935872 1665138688\n", + "rslt: 35097935872 1669332992\n", + "rslt: 35081158656 1669332992\n", + "rslt: 35081158656 1669332992\n", + "rslt: 35081158656 1669332992\n", + "rslt: 35064381440 1673527296\n", + "rslt: 35064381440 1673527296\n", + "rslt: 35064381440 1673527296\n", + "rslt: 35047604224 1677721600\n", + "rslt: 35047604224 1677721600\n", + "rslt: 35047604224 1677721600\n", + "rslt: 35047604224 1681915904\n", + "rslt: 35030827008 1681915904\n", + "rslt: 35030827008 1681915904\n", + "rslt: 35030827008 1686110208\n", + "rslt: 35014049792 1686110208\n", + "rslt: 35014049792 1686110208\n", + "rslt: 35014049792 1690304512\n", + "rslt: 34997272576 1690304512\n", + "rslt: 34997272576 1690304512\n", + "rslt: 34997272576 1694498816\n", + "rslt: 34980495360 1694498816\n", + "rslt: 34980495360 1694498816\n", + "rslt: 34980495360 1698693120\n", + "rslt: 34963718144 1698693120\n", + "rslt: 34963718144 1698693120\n", + "rslt: 34963718144 1698693120\n", + "rslt: 34946940928 1702887424\n", + "rslt: 34946940928 1702887424\n", + "rslt: 34946940928 1702887424\n", + "rslt: 34930163712 1707081728\n", + "rslt: 34930163712 1707081728\n", + "rslt: 34930163712 1707081728\n", + "rslt: 34913386496 1711276032\n", + "rslt: 34913386496 1711276032\n", + "rslt: 34913386496 1711276032\n", + "rslt: 34896609280 1715470336\n", + "rslt: 34896609280 1715470336\n", + "rslt: 34896609280 1715470336\n", + "rslt: 34879832064 1719664640\n", + "rslt: 34879832064 1719664640\n", + "rslt: 34879832064 1719664640\n", + "rslt: 34863054848 1723858944\n", + "rslt: 34863054848 1723858944\n", + "rslt: 34863054848 1723858944\n", + "rslt: 34846277632 1728053248\n", + "rslt: 34846277632 1728053248\n", + "rslt: 34846277632 1728053248\n", + "rslt: 34829500416 1728053248\n", + "rslt: 34829500416 1732247552\n", + "rslt: 34829500416 1732247552\n", + "rslt: 34812723200 1732247552\n", + "rslt: 34812723200 1736441856\n", + "rslt: 34812723200 1736441856\n", + "rslt: 34795945984 1736441856\n", + "rslt: 34795945984 1740636160\n", + "rslt: 34795945984 1740636160\n", + "rslt: 34779168768 1740636160\n", + "rslt: 34779168768 1744830464\n", + "rslt: 34779168768 1744830464\n", + "rslt: 34762391552 1744830464\n", + "rslt: 34762391552 1749024768\n", + "rslt: 34762391552 1749024768\n", + "rslt: 34745614336 1749024768\n", + "rslt: 34745614336 1753219072\n", + "rslt: 34745614336 1753219072\n", + "rslt: 34728837120 1753219072\n", + "rslt: 34728837120 1757413376\n", + "rslt: 34728837120 1757413376\n", + "rslt: 34712059904 1757413376\n", + "rslt: 34712059904 1757413376\n", + "rslt: 34712059904 1761607680\n", + "rslt: 34695282688 1761607680\n", + "rslt: 34695282688 1761607680\n", + "rslt: 34695282688 1765801984\n", + "rslt: 34678505472 1765801984\n", + "rslt: 34678505472 1765801984\n", + "rslt: 34678505472 1769996288\n", + "rslt: 34661728256 1769996288\n", + "rslt: 34661728256 1769996288\n", + "rslt: 34661728256 1774190592\n", + "rslt: 34644951040 1774190592\n", + "rslt: 34644951040 1774190592\n", + "rslt: 34644951040 1778384896\n", + "rslt: 34628173824 1778384896\n", + "rslt: 34628173824 1778384896\n", + "rslt: 34628173824 1782579200\n", + "rslt: 34611396608 1782579200\n", + "rslt: 34611396608 1782579200\n", + "rslt: 34611396608 1786773504\n", + "rslt: 34594619392 1786773504\n", + "rslt: 34594619392 1786773504\n", + "rslt: 34594619392 1786773504\n", + "rslt: 34577842176 1790967808\n", + "rslt: 34577842176 1790967808\n", + "rslt: 34577842176 1790967808\n", + "rslt: 34561064960 1795162112\n", + "rslt: 34561064960 1795162112\n", + "rslt: 34561064960 1795162112\n", + "rslt: 34544287744 1799356416\n", + "rslt: 34544287744 1799356416\n", + "rslt: 34544287744 1799356416\n", + "rslt: 34527510528 1803550720\n", + "rslt: 34527510528 1803550720\n", + "rslt: 34527510528 1803550720\n", + "rslt: 34510733312 1807745024\n", + "rslt: 34510733312 1807745024\n", + "rslt: 34510733312 1807745024\n", + "rslt: 34493956096 1811939328\n", + "rslt: 34493956096 1811939328\n", + "rslt: 34493956096 1811939328\n", + "rslt: 34477178880 1811939328\n", + "rslt: 34477178880 1816133632\n", + "rslt: 34477178880 1816133632\n", + "rslt: 34460401664 1816133632\n", + "rslt: 34460401664 1820327936\n", + "rslt: 34460401664 1820327936\n", + "rslt: 34443624448 1820327936\n", + "rslt: 34443624448 1824522240\n", + "rslt: 34443624448 1824522240\n", + "rslt: 34426847232 1824522240\n", + "rslt: 34426847232 1828716544\n", + "rslt: 34426847232 1828716544\n", + "rslt: 34410070016 1828716544\n", + "rslt: 34410070016 1832910848\n", + "rslt: 34410070016 1832910848\n", + "rslt: 34393292800 1832910848\n", + "rslt: 34393292800 1837105152\n", + "rslt: 34393292800 1837105152\n", + "rslt: 34376515584 1837105152\n", + "rslt: 34376515584 1841299456\n", + "rslt: 34376515584 1841299456\n", + "rslt: 34359738368 1841299456\n", + "rslt: 34359738368 1841299456\n", + "rslt: 34359738368 1845493760\n", + "rslt: 34342961152 1845493760\n", + "rslt: 34342961152 1845493760\n", + "rslt: 34342961152 1849688064\n", + "rslt: 34326183936 1849688064\n", + "rslt: 34326183936 1849688064\n", + "rslt: 34326183936 1853882368\n", + "rslt: 34309406720 1853882368\n", + "rslt: 34309406720 1853882368\n", + "rslt: 34309406720 1858076672\n", + "rslt: 34292629504 1858076672\n", + "rslt: 34292629504 1858076672\n", + "rslt: 34292629504 1862270976\n", + "rslt: 34275852288 1862270976\n", + "rslt: 34275852288 1862270976\n", + "rslt: 34275852288 1866465280\n", + "rslt: 34259075072 1866465280\n", + "rslt: 34259075072 1866465280\n", + "rslt: 34259075072 1870659584\n", + "rslt: 34242297856 1870659584\n", + "rslt: 34242297856 1870659584\n", + "rslt: 34242297856 1870659584\n", + "rslt: 34225520640 1874853888\n", + "rslt: 34225520640 1874853888\n", + "rslt: 34225520640 1874853888\n", + "rslt: 34208743424 1879048192\n", + "rslt: 34208743424 1879048192\n", + "rslt: 34208743424 1879048192\n", + "rslt: 34191966208 1883242496\n", + "rslt: 34191966208 1883242496\n", + "rslt: 34191966208 1883242496\n", + "rslt: 34175188992 1887436800\n", + "rslt: 34175188992 1887436800\n", + "rslt: 34175188992 1887436800\n", + "rslt: 34158411776 1891631104\n", + "rslt: 34158411776 1891631104\n", + "rslt: 34158411776 1891631104\n", + "rslt: 34141634560 1895825408\n", + "rslt: 34141634560 1895825408\n", + "rslt: 34141634560 1895825408\n", + "rslt: 34124857344 1900019712\n", + "rslt: 34124857344 1900019712\n", + "rslt: 34124857344 1900019712\n", + "rslt: 34108080128 1900019712\n", + "rslt: 34108080128 1904214016\n", + "rslt: 34108080128 1904214016\n", + "rslt: 34091302912 1904214016\n", + "rslt: 34091302912 1908408320\n", + "rslt: 34091302912 1908408320\n", + "rslt: 34074525696 1908408320\n", + "rslt: 34074525696 1912602624\n", + "rslt: 34074525696 1912602624\n", + "rslt: 34057748480 1912602624\n", + "rslt: 34057748480 1916796928\n", + "rslt: 34057748480 1916796928\n", + "rslt: 34040971264 1916796928\n", + "rslt: 34040971264 1920991232\n", + "rslt: 34040971264 1920991232\n", + "rslt: 34024194048 1920991232\n", + "rslt: 34024194048 1925185536\n", + "rslt: 34024194048 1925185536\n", + "rslt: 34007416832 1925185536\n", + "rslt: 34007416832 1929379840\n", + "rslt: 34007416832 1929379840\n", + "rslt: 33990639616 1929379840\n", + "rslt: 33990639616 1929379840\n", + "rslt: 33990639616 1933574144\n", + "rslt: 33973862400 1933574144\n", + "rslt: 33973862400 1933574144\n", + "rslt: 33973862400 1937768448\n", + "rslt: 33957085184 1937768448\n", + "rslt: 33957085184 1937768448\n", + "rslt: 33957085184 1941962752\n", + "rslt: 33940307968 1941962752\n", + "rslt: 33940307968 1941962752\n", + "rslt: 33940307968 1946157056\n", + "rslt: 33923530752 1946157056\n", + "rslt: 33923530752 1946157056\n", + "rslt: 33923530752 1950351360\n", + "rslt: 33906753536 1950351360\n", + "rslt: 33906753536 1950351360\n", + "rslt: 33906753536 1954545664\n", + "rslt: 33889976320 1954545664\n", + "rslt: 33889976320 1954545664\n", + "rslt: 33889976320 1958739968\n", + "rslt: 33889976320 1958739968\n", + "rslt: 33873199104 1958739968\n", + "rslt: 33873199104 1958739968\n", + "rslt: 33873199104 1962934272\n", + "rslt: 33856421888 1962934272\n", + "rslt: 33856421888 1962934272\n", + "rslt: 33856421888 1967128576\n", + "rslt: 33839644672 1967128576\n", + "rslt: 33839644672 1967128576\n", + "rslt: 33839644672 1971322880\n", + "rslt: 33822867456 1971322880\n", + "rslt: 33822867456 1971322880\n", + "rslt: 33822867456 1975517184\n", + "rslt: 33806090240 1975517184\n", + "rslt: 33806090240 1975517184\n", + "rslt: 33806090240 1979711488\n", + "rslt: 33789313024 1979711488\n", + "rslt: 33789313024 1979711488\n", + "rslt: 33789313024 1983905792\n", + "rslt: 33772535808 1983905792\n", + "rslt: 33772535808 1983905792\n", + "rslt: 33772535808 1988100096\n", + "rslt: 33755758592 1988100096\n", + "rslt: 33755758592 1988100096\n", + "rslt: 33755758592 1988100096\n", + "rslt: 33738981376 1992294400\n", + "rslt: 33738981376 1992294400\n", + "rslt: 33738981376 1992294400\n", + "rslt: 33722204160 1996488704\n", + "rslt: 33722204160 1996488704\n", + "rslt: 33722204160 1996488704\n", + "rslt: 33705426944 2000683008\n", + "rslt: 33705426944 2000683008\n", + "rslt: 33705426944 2000683008\n", + "rslt: 33688649728 2004877312\n", + "rslt: 33688649728 2004877312\n", + "rslt: 33688649728 2004877312\n", + "rslt: 33671872512 2009071616\n", + "rslt: 33671872512 2009071616\n", + "rslt: 33671872512 2009071616\n", + "rslt: 33655095296 2013265920\n", + "rslt: 33655095296 2013265920\n", + "rslt: 33655095296 2013265920\n", + "rslt: 33638318080 2013265920\n", + "rslt: 33638318080 2017460224\n", + "rslt: 33638318080 2017460224\n", + "rslt: 33621540864 2017460224\n", + "rslt: 33621540864 2021654528\n", + "rslt: 33621540864 2021654528\n", + "rslt: 33604763648 2021654528\n", + "rslt: 33604763648 2025848832\n", + "rslt: 33604763648 2025848832\n", + "rslt: 33587986432 2025848832\n", + "rslt: 33587986432 2030043136\n", + "rslt: 33587986432 2030043136\n", + "rslt: 33571209216 2030043136\n", + "rslt: 33571209216 2034237440\n", + "rslt: 33571209216 2034237440\n", + "rslt: 33554432000 2034237440\n", + "rslt: 33554432000 2038431744\n", + "rslt: 33554432000 2038431744\n", + "rslt: 33537654784 2038431744\n", + "rslt: 33537654784 2042626048\n", + "rslt: 33537654784 2042626048\n", + "rslt: 33520877568 2042626048\n", + "rslt: 33520877568 2042626048\n", + "rslt: 33520877568 2046820352\n", + "rslt: 33504100352 2046820352\n", + "rslt: 33504100352 2046820352\n", + "rslt: 33504100352 2051014656\n", + "rslt: 33487323136 2051014656\n", + "rslt: 33487323136 2051014656\n", + "rslt: 33487323136 2055208960\n", + "rslt: 33470545920 2055208960\n", + "rslt: 33470545920 2055208960\n", + "rslt: 33470545920 2059403264\n", + "rslt: 33453768704 2059403264\n", + "rslt: 33453768704 2059403264\n", + "rslt: 33453768704 2063597568\n", + "rslt: 33436991488 2063597568\n", + "rslt: 33436991488 2063597568\n", + "rslt: 33436991488 2067791872\n", + "rslt: 33420214272 2067791872\n", + "rslt: 33420214272 2067791872\n", + "rslt: 33420214272 2071986176\n", + "rslt: 33403437056 2071986176\n", + "rslt: 33403437056 2071986176\n", + "rslt: 33403437056 2071986176\n", + "rslt: 33386659840 2076180480\n", + "rslt: 33386659840 2076180480\n", + "rslt: 33386659840 2076180480\n", + "rslt: 33369882624 2080374784\n", + "rslt: 33369882624 2080374784\n", + "rslt: 33369882624 2080374784\n", + "rslt: 33353105408 2084569088\n", + "rslt: 33353105408 2084569088\n", + "rslt: 33353105408 2084569088\n", + "rslt: 33336328192 2088763392\n", + "rslt: 33336328192 2088763392\n", + "rslt: 33336328192 2088763392\n", + "rslt: 33319550976 2092957696\n", + "rslt: 33319550976 2092957696\n", + "rslt: 33319550976 2092957696\n", + "rslt: 33302773760 2097152000\n", + "rslt: 33302773760 2097152000\n", + "rslt: 33302773760 2097152000\n", + "rslt: 33285996544 2101346304\n", + "rslt: 33285996544 2101346304\n", + "rslt: 33285996544 2101346304\n", + "rslt: 33269219328 2101346304\n", + "rslt: 33269219328 2105540608\n", + "rslt: 33269219328 2105540608\n", + "rslt: 33252442112 2105540608\n", + "rslt: 33252442112 2109734912\n", + "rslt: 33252442112 2109734912\n", + "rslt: 33235664896 2109734912\n", + "rslt: 33235664896 2113929216\n", + "rslt: 33235664896 2113929216\n", + "rslt: 33218887680 2113929216\n", + "rslt: 33218887680 2118123520\n", + "rslt: 33218887680 2118123520\n", + "rslt: 33202110464 2118123520\n", + "rslt: 33202110464 2122317824\n", + "rslt: 33202110464 2122317824\n", + "rslt: 33185333248 2122317824\n", + "rslt: 33185333248 2126512128\n", + "rslt: 33185333248 2126512128\n", + "rslt: 33168556032 2126512128\n", + "rslt: 33168556032 2130706432\n", + "rslt: 33168556032 2130706432\n", + "rslt: 33151778816 2130706432\n", + "rslt: 33151778816 2130706432\n", + "rslt: 33151778816 2134900736\n", + "rslt: 33135001600 2134900736\n", + "rslt: 33135001600 2134900736\n", + "rslt: 33135001600 2139095040\n", + "rslt: 33118224384 2139095040\n", + "rslt: 33118224384 2139095040\n", + "rslt: 33118224384 2143289344\n", + "rslt: 33101447168 2143289344\n", + "rslt: 33101447168 2143289344\n", + "rslt: 33101447168 2147483648\n", + "rslt: 33084669952 2147483648\n", + "rslt: 33084669952 2147483648\n", + "rslt: 33084669952 2151677952\n", + "rslt: 33067892736 2151677952\n", + "rslt: 33067892736 2151677952\n", + "rslt: 33067892736 2155872256\n", + "rslt: 33051115520 2155872256\n", + "rslt: 33051115520 2155872256\n", + "rslt: 33051115520 2160066560\n", + "rslt: 33034338304 2160066560\n", + "rslt: 33034338304 2160066560\n", + "rslt: 33034338304 2160066560\n", + "rslt: 33017561088 2164260864\n", + "rslt: 33017561088 2164260864\n", + "rslt: 33017561088 2164260864\n", + "rslt: 33000783872 2168455168\n", + "rslt: 33000783872 2168455168\n", + "rslt: 33000783872 2168455168\n", + "rslt: 32984006656 2172649472\n", + "rslt: 32984006656 2172649472\n", + "rslt: 32984006656 2172649472\n", + "rslt: 32967229440 2176843776\n", + "rslt: 32967229440 2176843776\n", + "rslt: 32967229440 2176843776\n", + "rslt: 32950452224 2181038080\n", + "rslt: 32950452224 2181038080\n", + "rslt: 32950452224 2181038080\n", + "rslt: 32933675008 2185232384\n", + "rslt: 32933675008 2185232384\n", + "rslt: 32933675008 2185232384\n", + "rslt: 32916897792 2189426688\n", + "rslt: 32916897792 2189426688\n", + "rslt: 32916897792 2189426688\n", + "rslt: 32900120576 2189426688\n", + "rslt: 32900120576 2193620992\n", + "rslt: 32900120576 2193620992\n", + "rslt: 32883343360 2193620992\n", + "rslt: 32883343360 2197815296\n", + "rslt: 32883343360 2197815296\n", + "rslt: 32866566144 2197815296\n", + "rslt: 32866566144 2202009600\n", + "rslt: 32866566144 2202009600\n", + "rslt: 32849788928 2202009600\n", + "rslt: 32849788928 2206203904\n", + "rslt: 32849788928 2206203904\n", + "rslt: 32833011712 2206203904\n", + "rslt: 32833011712 2210398208\n", + "rslt: 32833011712 2210398208\n", + "rslt: 32816234496 2210398208\n", + "rslt: 32816234496 2214592512\n", + "rslt: 32816234496 2214592512\n", + "rslt: 32799457280 2214592512\n", + "rslt: 32799457280 2214592512\n", + "rslt: 32799457280 2218786816\n", + "rslt: 32782680064 2218786816\n", + "rslt: 32782680064 2218786816\n", + "rslt: 32782680064 2222981120\n", + "rslt: 32765902848 2222981120\n", + "rslt: 32765902848 2222981120\n", + "rslt: 32765902848 2227175424\n", + "rslt: 32749125632 2227175424\n", + "rslt: 32749125632 2227175424\n", + "rslt: 32749125632 2231369728\n", + "rslt: 32732348416 2231369728\n", + "rslt: 32732348416 2231369728\n", + "rslt: 32732348416 2235564032\n", + "rslt: 32732348416 2235564032\n", + "rslt: 32715571200 2235564032\n", + "rslt: 32715571200 2239758336\n", + "rslt: 32715571200 2239758336\n", + "rslt: 32698793984 2239758336\n", + "rslt: 32698793984 2243952640\n", + "rslt: 32698793984 2243952640\n", + "rslt: 32682016768 2243952640\n", + "rslt: 32682016768 2243952640\n", + "rslt: 32682016768 2248146944\n", + "rslt: 32665239552 2248146944\n", + "rslt: 32665239552 2248146944\n", + "rslt: 32665239552 2252341248\n", + "rslt: 32648462336 2252341248\n", + "rslt: 32648462336 2252341248\n", + "rslt: 32648462336 2256535552\n", + "rslt: 32631685120 2256535552\n", + "rslt: 32631685120 2256535552\n", + "rslt: 32631685120 2260729856\n", + "rslt: 32614907904 2260729856\n", + "rslt: 32614907904 2260729856\n", + "rslt: 32614907904 2264924160\n", + "rslt: 32598130688 2264924160\n", + "rslt: 32598130688 2264924160\n", + "rslt: 32598130688 2269118464\n", + "rslt: 32581353472 2269118464\n", + "rslt: 32581353472 2269118464\n", + "rslt: 32581353472 2273312768\n", + "rslt: 32564576256 2273312768\n", + "rslt: 32564576256 2273312768\n", + "rslt: 32564576256 2273312768\n", + "rslt: 32547799040 2277507072\n", + "rslt: 32547799040 2277507072\n", + "rslt: 32547799040 2277507072\n", + "rslt: 32531021824 2281701376\n", + "rslt: 32531021824 2281701376\n", + "rslt: 32531021824 2281701376\n", + "rslt: 32514244608 2285895680\n", + "rslt: 32514244608 2285895680\n", + "rslt: 32514244608 2285895680\n", + "rslt: 32497467392 2290089984\n", + "rslt: 32497467392 2290089984\n", + "rslt: 32497467392 2290089984\n", + "rslt: 32480690176 2294284288\n", + "rslt: 32480690176 2294284288\n", + "rslt: 32480690176 2294284288\n", + "rslt: 32463912960 2298478592\n", + "rslt: 32463912960 2298478592\n", + "rslt: 32463912960 2298478592\n", + "rslt: 32447135744 2302672896\n", + "rslt: 32447135744 2302672896\n", + "rslt: 32447135744 2302672896\n", + "rslt: 32430358528 2302672896\n", + "rslt: 32430358528 2306867200\n", + "rslt: 32430358528 2306867200\n", + "rslt: 32413581312 2306867200\n", + "rslt: 32413581312 2311061504\n", + "rslt: 32413581312 2311061504\n", + "rslt: 32396804096 2311061504\n", + "rslt: 32396804096 2315255808\n", + "rslt: 32396804096 2315255808\n", + "rslt: 32380026880 2315255808\n", + "rslt: 32380026880 2319450112\n", + "rslt: 32380026880 2319450112\n", + "rslt: 32363249664 2319450112\n", + "rslt: 32363249664 2323644416\n", + "rslt: 32363249664 2323644416\n", + "rslt: 32346472448 2323644416\n", + "rslt: 32346472448 2327838720\n", + "rslt: 32346472448 2327838720\n", + "rslt: 32329695232 2327838720\n", + "rslt: 32329695232 2332033024\n", + "rslt: 32329695232 2332033024\n", + "rslt: 32312918016 2332033024\n", + "rslt: 32312918016 2332033024\n", + "rslt: 32312918016 2336227328\n", + "rslt: 32296140800 2336227328\n", + "rslt: 32296140800 2336227328\n", + "rslt: 32296140800 2340421632\n", + "rslt: 32279363584 2340421632\n", + "rslt: 32279363584 2340421632\n", + "rslt: 32279363584 2344615936\n", + "rslt: 32262586368 2344615936\n", + "rslt: 32262586368 2344615936\n", + "rslt: 32262586368 2348810240\n", + "rslt: 32245809152 2348810240\n", + "rslt: 32245809152 2348810240\n", + "rslt: 32245809152 2353004544\n", + "rslt: 32229031936 2353004544\n", + "rslt: 32229031936 2353004544\n", + "rslt: 32229031936 2357198848\n", + "rslt: 32212254720 2357198848\n", + "rslt: 32212254720 2357198848\n", + "rslt: 32212254720 2361393152\n", + "rslt: 32195477504 2361393152\n", + "rslt: 32195477504 2361393152\n", + "rslt: 32195477504 2361393152\n", + "rslt: 32178700288 2365587456\n", + "rslt: 32178700288 2365587456\n", + "rslt: 32178700288 2365587456\n", + "rslt: 32161923072 2369781760\n", + "rslt: 32161923072 2369781760\n", + "rslt: 32161923072 2369781760\n", + "rslt: 32145145856 2373976064\n", + "rslt: 32145145856 2373976064\n", + "rslt: 32145145856 2373976064\n", + "rslt: 32128368640 2378170368\n", + "rslt: 32128368640 2378170368\n", + "rslt: 32128368640 2378170368\n", + "rslt: 32111591424 2382364672\n", + "rslt: 32111591424 2382364672\n", + "rslt: 32111591424 2382364672\n", + "rslt: 32094814208 2386558976\n", + "rslt: 32094814208 2386558976\n", + "rslt: 32094814208 2386558976\n", + "rslt: 32078036992 2390753280\n", + "rslt: 32078036992 2390753280\n", + "rslt: 32078036992 2390753280\n", + "rslt: 32061259776 2390753280\n", + "rslt: 32061259776 2394947584\n", + "rslt: 32061259776 2394947584\n", + "rslt: 32044482560 2394947584\n", + "rslt: 32044482560 2399141888\n", + "rslt: 32044482560 2399141888\n", + "rslt: 32027705344 2399141888\n", + "rslt: 32027705344 2403336192\n", + "rslt: 32027705344 2403336192\n", + "rslt: 32010928128 2403336192\n", + "rslt: 32010928128 2407530496\n", + "rslt: 32010928128 2407530496\n", + "rslt: 31994150912 2407530496\n", + "rslt: 31994150912 2411724800\n", + "rslt: 31994150912 2411724800\n", + "rslt: 31977373696 2411724800\n", + "rslt: 31977373696 2415919104\n", + "rslt: 31977373696 2415919104\n", + "rslt: 31960596480 2415919104\n", + "rslt: 31960596480 2415919104\n", + "rslt: 31960596480 2420113408\n", + "rslt: 31943819264 2420113408\n", + "rslt: 31943819264 2420113408\n", + "rslt: 31943819264 2424307712\n", + "rslt: 31927042048 2424307712\n", + "rslt: 31927042048 2424307712\n", + "rslt: 31927042048 2428502016\n", + "rslt: 31910264832 2428502016\n", + "rslt: 31910264832 2428502016\n", + "rslt: 31910264832 2432696320\n", + "rslt: 31893487616 2432696320\n", + "rslt: 31893487616 2432696320\n", + "rslt: 31893487616 2436890624\n", + "rslt: 31876710400 2436890624\n", + "rslt: 31876710400 2436890624\n", + "rslt: 31876710400 2441084928\n", + "rslt: 31859933184 2441084928\n", + "rslt: 31859933184 2441084928\n", + "rslt: 31859933184 2445279232\n", + "rslt: 31843155968 2445279232\n", + "rslt: 31843155968 2445279232\n", + "rslt: 31843155968 2445279232\n", + "rslt: 31826378752 2449473536\n", + "rslt: 31826378752 2449473536\n", + "rslt: 31826378752 2449473536\n", + "rslt: 31809601536 2453667840\n", + "rslt: 31809601536 2453667840\n", + "rslt: 31809601536 2453667840\n", + "rslt: 31792824320 2457862144\n", + "rslt: 31792824320 2457862144\n", + "rslt: 31792824320 2457862144\n", + "rslt: 31776047104 2462056448\n", + "rslt: 31776047104 2462056448\n", + "rslt: 31776047104 2462056448\n", + "rslt: 31759269888 2466250752\n", + "rslt: 31759269888 2466250752\n", + "rslt: 31759269888 2466250752\n", + "rslt: 31742492672 2470445056\n", + "rslt: 31742492672 2470445056\n", + "rslt: 31742492672 2470445056\n", + "rslt: 31725715456 2474639360\n", + "rslt: 31725715456 2474639360\n", + "rslt: 31725715456 2474639360\n", + "rslt: 31708938240 2474639360\n", + "rslt: 31708938240 2478833664\n", + "rslt: 31708938240 2478833664\n", + "rslt: 31692161024 2478833664\n", + "rslt: 31692161024 2483027968\n", + "rslt: 31692161024 2483027968\n", + "rslt: 31675383808 2483027968\n", + "rslt: 31675383808 2487222272\n", + "rslt: 31675383808 2487222272\n", + "rslt: 31658606592 2487222272\n", + "rslt: 31658606592 2491416576\n", + "rslt: 31658606592 2491416576\n", + "rslt: 31641829376 2491416576\n", + "rslt: 31641829376 2495610880\n", + "rslt: 31641829376 2495610880\n", + "rslt: 31625052160 2495610880\n", + "rslt: 31625052160 2499805184\n", + "rslt: 31625052160 2499805184\n", + "rslt: 31608274944 2499805184\n", + "rslt: 31608274944 2503999488\n", + "rslt: 31608274944 2503999488\n", + "rslt: 31591497728 2503999488\n", + "rslt: 31591497728 2503999488\n", + "rslt: 31591497728 2508193792\n", + "rslt: 31574720512 2508193792\n", + "rslt: 31574720512 2508193792\n", + "rslt: 31574720512 2512388096\n", + "rslt: 31557943296 2512388096\n", + "rslt: 31557943296 2512388096\n", + "rslt: 31557943296 2516582400\n", + "rslt: 31557943296 2516582400\n", + "rslt: 31541166080 2516582400\n", + "rslt: 31541166080 2520776704\n", + "rslt: 31541166080 2520776704\n", + "rslt: 31524388864 2520776704\n", + "rslt: 31524388864 2524971008\n", + "rslt: 31524388864 2524971008\n", + "rslt: 31507611648 2524971008\n", + "rslt: 31507611648 2529165312\n", + "rslt: 31507611648 2529165312\n", + "rslt: 31490834432 2529165312\n", + "rslt: 31490834432 2533359616\n", + "rslt: 31490834432 2533359616\n", + "rslt: 31474057216 2533359616\n", + "rslt: 31474057216 2533359616\n", + "rslt: 31474057216 2537553920\n", + "rslt: 31457280000 2537553920\n", + "rslt: 31457280000 2537553920\n", + "rslt: 31457280000 2541748224\n", + "rslt: 31440502784 2541748224\n", + "rslt: 31440502784 2541748224\n", + "rslt: 31440502784 2545942528\n", + "rslt: 31423725568 2545942528\n", + "rslt: 31423725568 2545942528\n", + "rslt: 31423725568 2550136832\n", + "rslt: 31406948352 2550136832\n", + "rslt: 31406948352 2550136832\n", + "rslt: 31406948352 2554331136\n", + "rslt: 31390171136 2554331136\n", + "rslt: 31390171136 2554331136\n", + "rslt: 31390171136 2558525440\n", + "rslt: 31373393920 2558525440\n", + "rslt: 31373393920 2558525440\n", + "rslt: 31373393920 2562719744\n", + "rslt: 31356616704 2562719744\n", + "rslt: 31356616704 2562719744\n", + "rslt: 31356616704 2562719744\n", + "rslt: 31339839488 2566914048\n", + "rslt: 31339839488 2566914048\n", + "rslt: 31339839488 2566914048\n", + "rslt: 31323062272 2571108352\n", + "rslt: 31323062272 2571108352\n", + "rslt: 31323062272 2571108352\n", + "rslt: 31306285056 2575302656\n", + "rslt: 31306285056 2575302656\n", + "rslt: 31306285056 2575302656\n", + "rslt: 31289507840 2579496960\n", + "rslt: 31289507840 2579496960\n", + "rslt: 31289507840 2579496960\n", + "rslt: 31272730624 2583691264\n", + "rslt: 31272730624 2583691264\n", + "rslt: 31272730624 2583691264\n", + "rslt: 31255953408 2587885568\n", + "rslt: 31255953408 2587885568\n", + "rslt: 31255953408 2587885568\n", + "rslt: 31239176192 2592079872\n", + "rslt: 31239176192 2592079872\n", + "rslt: 31239176192 2592079872\n", + "rslt: 31222398976 2592079872\n", + "rslt: 31222398976 2596274176\n", + "rslt: 31222398976 2596274176\n", + "rslt: 31205621760 2596274176\n", + "rslt: 31205621760 2600468480\n", + "rslt: 31205621760 2600468480\n", + "rslt: 31188844544 2600468480\n", + "rslt: 31188844544 2604662784\n", + "rslt: 31188844544 2604662784\n", + "rslt: 31172067328 2604662784\n", + "rslt: 31172067328 2608857088\n", + "rslt: 31172067328 2608857088\n", + "rslt: 31155290112 2608857088\n", + "rslt: 31155290112 2613051392\n", + "rslt: 31155290112 2613051392\n", + "rslt: 31138512896 2613051392\n", + "rslt: 31138512896 2617245696\n", + "rslt: 31138512896 2617245696\n", + "rslt: 31121735680 2617245696\n", + "rslt: 31121735680 2617245696\n", + "rslt: 31121735680 2621440000\n", + "rslt: 31104958464 2621440000\n", + "rslt: 31104958464 2621440000\n", + "rslt: 31104958464 2625634304\n", + "rslt: 31088181248 2625634304\n", + "rslt: 31088181248 2625634304\n", + "rslt: 31088181248 2629828608\n", + "rslt: 31071404032 2629828608\n", + "rslt: 31071404032 2629828608\n", + "rslt: 31071404032 2634022912\n", + "rslt: 31054626816 2634022912\n", + "rslt: 31054626816 2634022912\n", + "rslt: 31054626816 2638217216\n", + "rslt: 31037849600 2638217216\n", + "rslt: 31037849600 2638217216\n", + "rslt: 31037849600 2642411520\n", + "rslt: 31021072384 2642411520\n", + "rslt: 31021072384 2642411520\n", + "rslt: 31021072384 2646605824\n", + "rslt: 31004295168 2646605824\n", + "rslt: 31004295168 2646605824\n", + "rslt: 31004295168 2646605824\n", + "rslt: 30987517952 2650800128\n", + "rslt: 30987517952 2650800128\n", + "rslt: 30987517952 2650800128\n", + "rslt: 30970740736 2654994432\n", + "rslt: 30970740736 2654994432\n", + "rslt: 30970740736 2654994432\n", + "rslt: 30953963520 2659188736\n", + "rslt: 30953963520 2659188736\n", + "rslt: 30953963520 2659188736\n", + "rslt: 30937186304 2663383040\n", + "rslt: 30937186304 2663383040\n", + "rslt: 30937186304 2663383040\n", + "rslt: 30920409088 2667577344\n", + "rslt: 30920409088 2667577344\n", + "rslt: 30920409088 2667577344\n", + "rslt: 30903631872 2671771648\n", + "rslt: 30903631872 2671771648\n", + "rslt: 30903631872 2671771648\n", + "rslt: 30886854656 2675965952\n", + "rslt: 30886854656 2675965952\n", + "rslt: 30886854656 2675965952\n", + "rslt: 30870077440 2675965952\n", + "rslt: 30870077440 2680160256\n", + "rslt: 30870077440 2680160256\n", + "rslt: 30853300224 2680160256\n", + "rslt: 30853300224 2684354560\n", + "rslt: 30853300224 2684354560\n", + "rslt: 30836523008 2684354560\n", + "rslt: 30836523008 2688548864\n", + "rslt: 30836523008 2688548864\n", + "rslt: 30819745792 2688548864\n", + "rslt: 30819745792 2692743168\n", + "rslt: 30819745792 2692743168\n", + "rslt: 30802968576 2692743168\n", + "rslt: 30802968576 2696937472\n", + "rslt: 30802968576 2696937472\n", + "rslt: 30786191360 2696937472\n", + "rslt: 30786191360 2701131776\n", + "rslt: 30786191360 2701131776\n", + "rslt: 30769414144 2701131776\n", + "rslt: 30769414144 2705326080\n", + "rslt: 30769414144 2705326080\n", + "rslt: 30752636928 2705326080\n", + "rslt: 30752636928 2705326080\n", + "rslt: 30752636928 2709520384\n", + "rslt: 30735859712 2709520384\n", + "rslt: 30735859712 2709520384\n", + "rslt: 30735859712 2713714688\n", + "rslt: 30719082496 2713714688\n", + "rslt: 30719082496 2713714688\n", + "rslt: 30719082496 2717908992\n", + "rslt: 30702305280 2717908992\n", + "rslt: 30702305280 2717908992\n", + "rslt: 30702305280 2722103296\n", + "rslt: 30685528064 2722103296\n", + "rslt: 30685528064 2722103296\n", + "rslt: 30685528064 2726297600\n", + "rslt: 30668750848 2726297600\n", + "rslt: 30668750848 2726297600\n", + "rslt: 30668750848 2730491904\n", + "rslt: 30651973632 2730491904\n", + "rslt: 30651973632 2730491904\n", + "rslt: 30651973632 2734686208\n", + "rslt: 30635196416 2734686208\n", + "rslt: 30635196416 2734686208\n", + "rslt: 30635196416 2734686208\n", + "rslt: 30618419200 2738880512\n", + "rslt: 30618419200 2738880512\n", + "rslt: 30618419200 2738880512\n", + "rslt: 30601641984 2743074816\n", + "rslt: 30601641984 2743074816\n", + "rslt: 30601641984 2743074816\n", + "rslt: 30584864768 2747269120\n", + "rslt: 30584864768 2747269120\n", + "rslt: 30584864768 2747269120\n", + "rslt: 30568087552 2751463424\n", + "rslt: 30568087552 2751463424\n", + "rslt: 30568087552 2751463424\n", + "rslt: 30551310336 2755657728\n", + "rslt: 30551310336 2755657728\n", + "rslt: 30551310336 2755657728\n", + "rslt: 30534533120 2759852032\n", + "rslt: 30534533120 2759852032\n", + "rslt: 30534533120 2759852032\n", + "rslt: 30517755904 2764046336\n", + "rslt: 30517755904 2764046336\n", + "rslt: 30517755904 2764046336\n", + "rslt: 30500978688 2764046336\n", + "rslt: 30500978688 2768240640\n", + "rslt: 30500978688 2768240640\n", + "rslt: 30484201472 2768240640\n", + "rslt: 30484201472 2772434944\n", + "rslt: 30484201472 2772434944\n", + "rslt: 30467424256 2772434944\n", + "rslt: 30467424256 2776629248\n", + "rslt: 30467424256 2776629248\n", + "rslt: 30450647040 2776629248\n", + "rslt: 30450647040 2780823552\n", + "rslt: 30450647040 2780823552\n", + "rslt: 30433869824 2780823552\n", + "rslt: 30433869824 2785017856\n", + "rslt: 30433869824 2785017856\n", + "rslt: 30417092608 2785017856\n", + "rslt: 30417092608 2789212160\n", + "rslt: 30417092608 2789212160\n", + "rslt: 30400315392 2789212160\n", + "rslt: 30400315392 2793406464\n", + "rslt: 30400315392 2793406464\n", + "rslt: 30400315392 2793406464\n", + "rslt: 30383538176 2793406464\n", + "rslt: 30383538176 2797600768\n", + "rslt: 30383538176 2797600768\n", + "rslt: 30366760960 2797600768\n", + "rslt: 30366760960 2801795072\n", + "rslt: 30366760960 2801795072\n", + "rslt: 30349983744 2801795072\n", + "rslt: 30349983744 2805989376\n", + "rslt: 30349983744 2805989376\n", + "rslt: 30333206528 2805989376\n", + "rslt: 30333206528 2810183680\n", + "rslt: 30333206528 2810183680\n", + "rslt: 30316429312 2810183680\n", + "rslt: 30316429312 2814377984\n", + "rslt: 30316429312 2814377984\n", + "rslt: 30299652096 2814377984\n", + "rslt: 30299652096 2818572288\n", + "rslt: 30299652096 2818572288\n", + "rslt: 30282874880 2818572288\n", + "rslt: 30282874880 2822766592\n", + "rslt: 30282874880 2822766592\n", + "rslt: 30266097664 2822766592\n", + "rslt: 30266097664 2822766592\n", + "rslt: 30266097664 2826960896\n", + "rslt: 30249320448 2826960896\n", + "rslt: 30249320448 2826960896\n", + "rslt: 30249320448 2831155200\n", + "rslt: 30232543232 2831155200\n", + "rslt: 30232543232 2831155200\n", + "rslt: 30232543232 2835349504\n", + "rslt: 30215766016 2835349504\n", + "rslt: 30215766016 2835349504\n", + "rslt: 30215766016 2839543808\n", + "rslt: 30198988800 2839543808\n", + "rslt: 30198988800 2839543808\n", + "rslt: 30198988800 2843738112\n", + "rslt: 30182211584 2843738112\n", + "rslt: 30182211584 2843738112\n", + "rslt: 30182211584 2847932416\n", + "rslt: 30165434368 2847932416\n", + "rslt: 30165434368 2847932416\n", + "rslt: 30165434368 2847932416\n", + "rslt: 30148657152 2852126720\n", + "rslt: 30148657152 2852126720\n", + "rslt: 30148657152 2852126720\n", + "rslt: 30131879936 2856321024\n", + "rslt: 30131879936 2856321024\n", + "rslt: 30131879936 2856321024\n", + "rslt: 30115102720 2860515328\n", + "rslt: 30115102720 2860515328\n", + "rslt: 30115102720 2860515328\n", + "rslt: 30098325504 2864709632\n", + "rslt: 30098325504 2864709632\n", + "rslt: 30098325504 2864709632\n", + "rslt: 30081548288 2868903936\n", + "rslt: 30081548288 2868903936\n", + "rslt: 30081548288 2868903936\n", + "rslt: 30064771072 2873098240\n", + "rslt: 30064771072 2873098240\n", + "rslt: 30064771072 2873098240\n", + "rslt: 30047993856 2877292544\n", + "rslt: 30047993856 2877292544\n", + "rslt: 30047993856 2877292544\n", + "rslt: 30031216640 2877292544\n", + "rslt: 30031216640 2881486848\n", + "rslt: 30031216640 2881486848\n", + "rslt: 30014439424 2881486848\n", + "rslt: 30014439424 2885681152\n", + "rslt: 30014439424 2885681152\n", + "rslt: 29997662208 2885681152\n", + "rslt: 29997662208 2889875456\n", + "rslt: 29997662208 2889875456\n", + "rslt: 29980884992 2889875456\n", + "rslt: 29980884992 2894069760\n", + "rslt: 29980884992 2894069760\n", + "rslt: 29964107776 2894069760\n", + "rslt: 29964107776 2898264064\n", + "rslt: 29964107776 2898264064\n", + "rslt: 29947330560 2898264064\n", + "rslt: 29947330560 2902458368\n", + "rslt: 29947330560 2902458368\n", + "rslt: 29930553344 2902458368\n", + "rslt: 29930553344 2906652672\n", + "rslt: 29930553344 2906652672\n", + "rslt: 29913776128 2906652672\n", + "rslt: 29913776128 2906652672\n", + "rslt: 29913776128 2910846976\n", + "rslt: 29896998912 2910846976\n", + "rslt: 29896998912 2910846976\n", + "rslt: 29896998912 2915041280\n", + "rslt: 29880221696 2915041280\n", + "rslt: 29880221696 2915041280\n", + "rslt: 29880221696 2919235584\n", + "rslt: 29863444480 2919235584\n", + "rslt: 29863444480 2919235584\n", + "rslt: 29863444480 2923429888\n", + "rslt: 29846667264 2923429888\n", + "rslt: 29846667264 2923429888\n", + "rslt: 29846667264 2927624192\n", + "rslt: 29829890048 2927624192\n", + "rslt: 29829890048 2927624192\n", + "rslt: 29829890048 2931818496\n", + "rslt: 29813112832 2931818496\n", + "rslt: 29813112832 2931818496\n", + "rslt: 29813112832 2936012800\n", + "rslt: 29796335616 2936012800\n", + "rslt: 29796335616 2936012800\n", + "rslt: 29796335616 2936012800\n", + "rslt: 29779558400 2940207104\n", + "rslt: 29779558400 2940207104\n", + "rslt: 29779558400 2940207104\n", + "rslt: 29762781184 2944401408\n", + "rslt: 29762781184 2944401408\n", + "rslt: 29762781184 2944401408\n", + "rslt: 29746003968 2948595712\n", + "rslt: 29746003968 2948595712\n", + "rslt: 29746003968 2948595712\n", + "rslt: 29729226752 2952790016\n", + "rslt: 29729226752 2952790016\n", + "rslt: 29729226752 2952790016\n", + "rslt: 29712449536 2956984320\n", + "rslt: 29712449536 2956984320\n", + "rslt: 29712449536 2956984320\n", + "rslt: 29695672320 2961178624\n", + "rslt: 29695672320 2961178624\n", + "rslt: 29695672320 2961178624\n", + "rslt: 29678895104 2965372928\n", + "rslt: 29678895104 2965372928\n", + "rslt: 29678895104 2965372928\n", + "rslt: 29662117888 2965372928\n", + "rslt: 29662117888 2969567232\n", + "rslt: 29662117888 2969567232\n", + "rslt: 29645340672 2969567232\n", + "rslt: 29645340672 2973761536\n", + "rslt: 29645340672 2973761536\n", + "rslt: 29628563456 2973761536\n", + "rslt: 29628563456 2977955840\n", + "rslt: 29628563456 2977955840\n", + "rslt: 29611786240 2977955840\n", + "rslt: 29611786240 2982150144\n", + "rslt: 29611786240 2982150144\n", + "rslt: 29595009024 2982150144\n", + "rslt: 29595009024 2986344448\n", + "rslt: 29595009024 2986344448\n", + "rslt: 29578231808 2986344448\n", + "rslt: 29578231808 2990538752\n", + "rslt: 29578231808 2990538752\n", + "rslt: 29561454592 2990538752\n", + "rslt: 29561454592 2994733056\n", + "rslt: 29561454592 2994733056\n", + "rslt: 29544677376 2994733056\n", + "rslt: 29544677376 2994733056\n", + "rslt: 29544677376 2998927360\n", + "rslt: 29527900160 2998927360\n", + "rslt: 29527900160 2998927360\n", + "rslt: 29527900160 3003121664\n", + "rslt: 29511122944 3003121664\n", + "rslt: 29511122944 3003121664\n", + "rslt: 29511122944 3007315968\n", + "rslt: 29494345728 3007315968\n", + "rslt: 29494345728 3007315968\n", + "rslt: 29494345728 3011510272\n", + "rslt: 29477568512 3011510272\n", + "rslt: 29477568512 3011510272\n", + "rslt: 29477568512 3015704576\n", + "rslt: 29460791296 3015704576\n", + "rslt: 29460791296 3015704576\n", + "rslt: 29460791296 3019898880\n", + "rslt: 29444014080 3019898880\n", + "rslt: 29444014080 3019898880\n", + "rslt: 29444014080 3024093184\n", + "rslt: 29427236864 3024093184\n", + "rslt: 29427236864 3024093184\n", + "rslt: 29427236864 3024093184\n", + "rslt: 29410459648 3028287488\n", + "rslt: 29410459648 3028287488\n", + "rslt: 29410459648 3028287488\n", + "rslt: 29393682432 3032481792\n", + "rslt: 29393682432 3032481792\n", + "rslt: 29393682432 3032481792\n", + "rslt: 29376905216 3036676096\n", + "rslt: 29376905216 3036676096\n", + "rslt: 29376905216 3036676096\n", + "rslt: 29360128000 3040870400\n", + "rslt: 29360128000 3040870400\n", + "rslt: 29360128000 3040870400\n", + "rslt: 29343350784 3045064704\n", + "rslt: 29343350784 3045064704\n", + "rslt: 29343350784 3045064704\n", + "rslt: 29326573568 3049259008\n", + "rslt: 29326573568 3049259008\n", + "rslt: 29326573568 3049259008\n", + "rslt: 29309796352 3049259008\n", + "rslt: 29309796352 3053453312\n", + "rslt: 29309796352 3053453312\n", + "rslt: 29293019136 3053453312\n", + "rslt: 29293019136 3057647616\n", + "rslt: 29293019136 3057647616\n", + "rslt: 29276241920 3057647616\n", + "rslt: 29276241920 3061841920\n", + "rslt: 29276241920 3061841920\n", + "rslt: 29259464704 3061841920\n", + "rslt: 29259464704 3066036224\n", + "rslt: 29259464704 3066036224\n", + "rslt: 29242687488 3066036224\n", + "rslt: 29242687488 3070230528\n", + "rslt: 29242687488 3070230528\n", + "rslt: 29242687488 3070230528\n", + "rslt: 29225910272 3074424832\n", + "rslt: 29225910272 3074424832\n", + "rslt: 29225910272 3074424832\n", + "rslt: 29209133056 3078619136\n", + "rslt: 29209133056 3078619136\n", + "rslt: 29209133056 3078619136\n", + "rslt: 29192355840 3078619136\n", + "rslt: 29192355840 3082813440\n", + "rslt: 29192355840 3082813440\n", + "rslt: 29175578624 3082813440\n", + "rslt: 29175578624 3087007744\n", + "rslt: 29175578624 3087007744\n", + "rslt: 29158801408 3087007744\n", + "rslt: 29158801408 3091202048\n", + "rslt: 29158801408 3091202048\n", + "rslt: 29142024192 3091202048\n", + "rslt: 29142024192 3095396352\n", + "rslt: 29142024192 3095396352\n", + "rslt: 29125246976 3095396352\n", + "rslt: 29125246976 3099590656\n", + "rslt: 29125246976 3099590656\n", + "rslt: 29108469760 3099590656\n", + "rslt: 29108469760 3103784960\n", + "rslt: 29108469760 3103784960\n", + "rslt: 29091692544 3103784960\n", + "rslt: 29091692544 3107979264\n", + "rslt: 29091692544 3107979264\n", + "rslt: 29074915328 3107979264\n", + "rslt: 29074915328 3107979264\n", + "rslt: 29074915328 3112173568\n", + "rslt: 29058138112 3112173568\n", + "rslt: 29058138112 3112173568\n", + "rslt: 29058138112 3116367872\n", + "rslt: 29041360896 3116367872\n", + "rslt: 29041360896 3116367872\n", + "rslt: 29041360896 3120562176\n", + "rslt: 29024583680 3120562176\n", + "rslt: 29024583680 3120562176\n", + "rslt: 29024583680 3124756480\n", + "rslt: 29007806464 3124756480\n", + "rslt: 29007806464 3124756480\n", + "rslt: 29007806464 3128950784\n", + "rslt: 28991029248 3128950784\n", + "rslt: 28991029248 3128950784\n", + "rslt: 28991029248 3133145088\n", + "rslt: 28974252032 3133145088\n", + "rslt: 28974252032 3133145088\n", + "rslt: 28974252032 3137339392\n", + "rslt: 28957474816 3137339392\n", + "rslt: 28957474816 3137339392\n", + "rslt: 28957474816 3137339392\n", + "rslt: 28940697600 3141533696\n", + "rslt: 28940697600 3141533696\n", + "rslt: 28940697600 3141533696\n", + "rslt: 28923920384 3145728000\n", + "rslt: 28923920384 3145728000\n", + "rslt: 28923920384 3145728000\n", + "rslt: 28907143168 3149922304\n", + "rslt: 28907143168 3149922304\n", + "rslt: 28907143168 3149922304\n", + "rslt: 28890365952 3154116608\n", + "rslt: 28890365952 3154116608\n", + "rslt: 28890365952 3154116608\n", + "rslt: 28873588736 3158310912\n", + "rslt: 28873588736 3158310912\n", + "rslt: 28873588736 3158310912\n", + "rslt: 28856811520 3162505216\n", + "rslt: 28856811520 3162505216\n", + "rslt: 28856811520 3162505216\n", + "rslt: 28840034304 3166699520\n", + "rslt: 28840034304 3166699520\n", + "rslt: 28840034304 3166699520\n", + "rslt: 28823257088 3166699520\n", + "rslt: 28823257088 3170893824\n", + "rslt: 28823257088 3170893824\n", + "rslt: 28806479872 3170893824\n", + "rslt: 28806479872 3175088128\n", + "rslt: 28806479872 3175088128\n", + "rslt: 28789702656 3175088128\n", + "rslt: 28789702656 3179282432\n", + "rslt: 28789702656 3179282432\n", + "rslt: 28772925440 3179282432\n", + "rslt: 28772925440 3183476736\n", + "rslt: 28772925440 3183476736\n", + "rslt: 28756148224 3183476736\n", + "rslt: 28756148224 3187671040\n", + "rslt: 28756148224 3187671040\n", + "rslt: 28739371008 3187671040\n", + "rslt: 28739371008 3191865344\n", + "rslt: 28739371008 3191865344\n", + "rslt: 28722593792 3191865344\n", + "rslt: 28722593792 3196059648\n", + "rslt: 28722593792 3196059648\n", + "rslt: 28705816576 3196059648\n", + "rslt: 28705816576 3196059648\n", + "rslt: 28705816576 3200253952\n", + "rslt: 28689039360 3200253952\n", + "rslt: 28689039360 3200253952\n", + "rslt: 28689039360 3204448256\n", + "rslt: 28672262144 3204448256\n", + "rslt: 28672262144 3204448256\n", + "rslt: 28672262144 3208642560\n", + "rslt: 28655484928 3208642560\n", + "rslt: 28655484928 3208642560\n", + "rslt: 28655484928 3212836864\n", + "rslt: 28638707712 3212836864\n", + "rslt: 28638707712 3212836864\n", + "rslt: 28638707712 3217031168\n", + "rslt: 28621930496 3217031168\n", + "rslt: 28621930496 3217031168\n", + "rslt: 28621930496 3221225472\n", + "rslt: 28605153280 3221225472\n", + "rslt: 28605153280 3221225472\n", + "rslt: 28605153280 3225419776\n", + "rslt: 28588376064 3225419776\n", + "rslt: 28588376064 3225419776\n", + "rslt: 28588376064 3225419776\n", + "rslt: 28571598848 3229614080\n", + "rslt: 28571598848 3229614080\n", + "rslt: 28571598848 3229614080\n", + "rslt: 28554821632 3233808384\n", + "rslt: 28554821632 3233808384\n", + "rslt: 28554821632 3233808384\n", + "rslt: 28538044416 3238002688\n", + "rslt: 28538044416 3238002688\n", + "rslt: 28538044416 3238002688\n", + "rslt: 28521267200 3242196992\n", + "rslt: 28521267200 3242196992\n", + "rslt: 28521267200 3242196992\n", + "rslt: 28504489984 3246391296\n", + "rslt: 28504489984 3246391296\n", + "rslt: 28504489984 3246391296\n", + "rslt: 28487712768 3250585600\n", + "rslt: 28487712768 3250585600\n", + "rslt: 28487712768 3250585600\n", + "rslt: 28470935552 3250585600\n", + "rslt: 28470935552 3254779904\n", + "rslt: 28470935552 3254779904\n", + "rslt: 28454158336 3254779904\n", + "rslt: 28454158336 3258974208\n", + "rslt: 28454158336 3258974208\n", + "rslt: 28437381120 3258974208\n", + "rslt: 28437381120 3263168512\n", + "rslt: 28437381120 3263168512\n", + "rslt: 28420603904 3263168512\n", + "rslt: 28420603904 3267362816\n", + "rslt: 28420603904 3267362816\n", + "rslt: 28403826688 3267362816\n", + "rslt: 28403826688 3271557120\n", + "rslt: 28403826688 3271557120\n", + "rslt: 28387049472 3271557120\n", + "rslt: 28387049472 3275751424\n", + "rslt: 28387049472 3275751424\n", + "rslt: 28370272256 3275751424\n", + "rslt: 28370272256 3279945728\n", + "rslt: 28370272256 3279945728\n", + "rslt: 28353495040 3279945728\n", + "rslt: 28353495040 3279945728\n", + "rslt: 28353495040 3284140032\n", + "rslt: 28336717824 3284140032\n", + "rslt: 28336717824 3284140032\n", + "rslt: 28336717824 3288334336\n", + "rslt: 28319940608 3288334336\n", + "rslt: 28319940608 3288334336\n", + "rslt: 28319940608 3292528640\n", + "rslt: 28303163392 3292528640\n", + "rslt: 28303163392 3292528640\n", + "rslt: 28303163392 3296722944\n", + "rslt: 28286386176 3296722944\n", + "rslt: 28286386176 3296722944\n", + "rslt: 28286386176 3300917248\n", + "rslt: 28269608960 3300917248\n", + "rslt: 28269608960 3300917248\n", + "rslt: 28269608960 3305111552\n", + "rslt: 28252831744 3305111552\n", + "rslt: 28252831744 3305111552\n", + "rslt: 28252831744 3309305856\n", + "rslt: 28236054528 3309305856\n", + "rslt: 28236054528 3309305856\n", + "rslt: 28236054528 3309305856\n", + "rslt: 28219277312 3313500160\n", + "rslt: 28219277312 3313500160\n", + "rslt: 28219277312 3313500160\n", + "rslt: 28202500096 3317694464\n", + "rslt: 28202500096 3317694464\n", + "rslt: 28202500096 3317694464\n", + "rslt: 28185722880 3321888768\n", + "rslt: 28185722880 3321888768\n", + "rslt: 28185722880 3321888768\n", + "rslt: 28168945664 3326083072\n", + "rslt: 28168945664 3326083072\n", + "rslt: 28168945664 3326083072\n", + "rslt: 28152168448 3330277376\n", + "rslt: 28152168448 3330277376\n", + "rslt: 28152168448 3330277376\n", + "rslt: 28135391232 3334471680\n", + "rslt: 28135391232 3334471680\n", + "rslt: 28135391232 3334471680\n", + "rslt: 28118614016 3338665984\n", + "rslt: 28118614016 3338665984\n", + "rslt: 28118614016 3338665984\n", + "rslt: 28101836800 3338665984\n", + "rslt: 28101836800 3342860288\n", + "rslt: 28101836800 3342860288\n", + "rslt: 28085059584 3342860288\n", + "rslt: 28085059584 3347054592\n", + "rslt: 28085059584 3347054592\n", + "rslt: 28068282368 3347054592\n", + "rslt: 28068282368 3351248896\n", + "rslt: 28068282368 3351248896\n", + "rslt: 28068282368 3351248896\n", + "rslt: 28051505152 3355443200\n", + "rslt: 28051505152 3355443200\n", + "rslt: 28051505152 3355443200\n", + "rslt: 28034727936 3359637504\n", + "rslt: 28034727936 3359637504\n", + "rslt: 28034727936 3359637504\n", + "rslt: 28017950720 3363831808\n", + "rslt: 28017950720 3363831808\n", + "rslt: 28017950720 3363831808\n", + "rslt: 28001173504 3368026112\n", + "rslt: 28001173504 3368026112\n", + "rslt: 28001173504 3368026112\n", + "rslt: 27984396288 3368026112\n", + "rslt: 27984396288 3372220416\n", + "rslt: 27984396288 3372220416\n", + "rslt: 27967619072 3372220416\n", + "rslt: 27967619072 3376414720\n", + "rslt: 27967619072 3376414720\n", + "rslt: 27950841856 3376414720\n", + "rslt: 27950841856 3380609024\n", + "rslt: 27950841856 3380609024\n", + "rslt: 27934064640 3380609024\n", + "rslt: 27934064640 3384803328\n", + "rslt: 27934064640 3384803328\n", + "rslt: 27917287424 3384803328\n", + "rslt: 27917287424 3388997632\n", + "rslt: 27917287424 3388997632\n", + "rslt: 27900510208 3388997632\n", + "rslt: 27900510208 3393191936\n", + "rslt: 27900510208 3393191936\n", + "rslt: 27883732992 3393191936\n", + "rslt: 27883732992 3397386240\n", + "rslt: 27883732992 3397386240\n", + "rslt: 27866955776 3397386240\n", + "rslt: 27866955776 3397386240\n", + "rslt: 27866955776 3401580544\n", + "rslt: 27850178560 3401580544\n", + "rslt: 27850178560 3401580544\n", + "rslt: 27850178560 3405774848\n", + "rslt: 27833401344 3405774848\n", + "rslt: 27833401344 3405774848\n", + "rslt: 27833401344 3409969152\n", + "rslt: 27816624128 3409969152\n", + "rslt: 27816624128 3409969152\n", + "rslt: 27816624128 3414163456\n", + "rslt: 27799846912 3414163456\n", + "rslt: 27799846912 3414163456\n", + "rslt: 27799846912 3418357760\n", + "rslt: 27783069696 3418357760\n", + "rslt: 27783069696 3418357760\n", + "rslt: 27783069696 3422552064\n", + "rslt: 27766292480 3422552064\n", + "rslt: 27766292480 3422552064\n", + "rslt: 27766292480 3426746368\n", + "rslt: 27749515264 3426746368\n", + "rslt: 27749515264 3426746368\n", + "rslt: 27749515264 3426746368\n", + "rslt: 27732738048 3430940672\n", + "rslt: 27732738048 3430940672\n", + "rslt: 27732738048 3430940672\n", + "rslt: 27715960832 3435134976\n", + "rslt: 27715960832 3435134976\n", + "rslt: 27715960832 3435134976\n", + "rslt: 27699183616 3439329280\n", + "rslt: 27699183616 3439329280\n", + "rslt: 27699183616 3439329280\n", + "rslt: 27682406400 3443523584\n", + "rslt: 27682406400 3443523584\n", + "rslt: 27682406400 3443523584\n", + "rslt: 27665629184 3447717888\n", + "rslt: 27665629184 3447717888\n", + "rslt: 27665629184 3447717888\n", + "rslt: 27648851968 3451912192\n", + "rslt: 27648851968 3451912192\n", + "rslt: 27648851968 3451912192\n", + "rslt: 27632074752 3451912192\n", + "rslt: 27632074752 3456106496\n", + "rslt: 27632074752 3456106496\n", + "rslt: 27615297536 3456106496\n", + "rslt: 27615297536 3460300800\n", + "rslt: 27615297536 3460300800\n", + "rslt: 27598520320 3460300800\n", + "rslt: 27598520320 3464495104\n", + "rslt: 27598520320 3464495104\n", + "rslt: 27581743104 3464495104\n", + "rslt: 27581743104 3468689408\n", + "rslt: 27581743104 3468689408\n", + "rslt: 27564965888 3468689408\n", + "rslt: 27564965888 3472883712\n", + "rslt: 27564965888 3472883712\n", + "rslt: 27548188672 3472883712\n", + "rslt: 27548188672 3477078016\n", + "rslt: 27548188672 3477078016\n", + "rslt: 27531411456 3477078016\n", + "rslt: 27531411456 3481272320\n", + "rslt: 27531411456 3481272320\n", + "rslt: 27514634240 3481272320\n", + "rslt: 27514634240 3481272320\n", + "rslt: 27514634240 3485466624\n", + "rslt: 27497857024 3485466624\n", + "rslt: 27497857024 3485466624\n", + "rslt: 27497857024 3489660928\n", + "rslt: 27481079808 3489660928\n", + "rslt: 27481079808 3489660928\n", + "rslt: 27481079808 3493855232\n", + "rslt: 27464302592 3493855232\n", + "rslt: 27464302592 3493855232\n", + "rslt: 27464302592 3498049536\n", + "rslt: 27447525376 3498049536\n", + "rslt: 27447525376 3498049536\n", + "rslt: 27447525376 3502243840\n", + "rslt: 27430748160 3502243840\n", + "rslt: 27430748160 3502243840\n", + "rslt: 27430748160 3506438144\n", + "rslt: 27413970944 3506438144\n", + "rslt: 27413970944 3506438144\n", + "rslt: 27413970944 3510632448\n", + "rslt: 27397193728 3510632448\n", + "rslt: 27397193728 3510632448\n", + "rslt: 27397193728 3510632448\n", + "rslt: 27380416512 3514826752\n", + "rslt: 27380416512 3514826752\n", + "rslt: 27380416512 3514826752\n", + "rslt: 27363639296 3519021056\n", + "rslt: 27363639296 3519021056\n", + "rslt: 27363639296 3519021056\n", + "rslt: 27346862080 3523215360\n", + "rslt: 27346862080 3523215360\n", + "rslt: 27346862080 3523215360\n", + "rslt: 27330084864 3527409664\n", + "rslt: 27330084864 3527409664\n", + "rslt: 27330084864 3527409664\n", + "rslt: 27313307648 3531603968\n", + "rslt: 27313307648 3531603968\n", + "rslt: 27313307648 3531603968\n", + "rslt: 27296530432 3535798272\n", + "rslt: 27296530432 3535798272\n", + "rslt: 27296530432 3535798272\n", + "rslt: 27279753216 3539992576\n", + "rslt: 27279753216 3539992576\n", + "rslt: 27279753216 3539992576\n", + "rslt: 27262976000 3539992576\n", + "rslt: 27262976000 3544186880\n", + "rslt: 27262976000 3544186880\n", + "rslt: 27246198784 3544186880\n", + "rslt: 27246198784 3548381184\n", + "rslt: 27246198784 3548381184\n", + "rslt: 27229421568 3548381184\n", + "rslt: 27229421568 3552575488\n", + "rslt: 27229421568 3552575488\n", + "rslt: 27212644352 3552575488\n", + "rslt: 27212644352 3556769792\n", + "rslt: 27212644352 3556769792\n", + "rslt: 27195867136 3556769792\n", + "rslt: 27195867136 3560964096\n", + "rslt: 27195867136 3560964096\n", + "rslt: 27179089920 3560964096\n", + "rslt: 27179089920 3565158400\n", + "rslt: 27179089920 3565158400\n", + "rslt: 27162312704 3565158400\n", + "rslt: 27162312704 3569352704\n", + "rslt: 27162312704 3569352704\n", + "rslt: 27145535488 3569352704\n", + "rslt: 27145535488 3569352704\n", + "rslt: 27145535488 3573547008\n", + "rslt: 27128758272 3573547008\n", + "rslt: 27128758272 3573547008\n", + "rslt: 27128758272 3577741312\n", + "rslt: 27111981056 3577741312\n", + "rslt: 27111981056 3577741312\n", + "rslt: 27111981056 3581935616\n", + "rslt: 27095203840 3581935616\n", + "rslt: 27095203840 3581935616\n", + "rslt: 27095203840 3586129920\n", + "rslt: 27078426624 3586129920\n", + "rslt: 27078426624 3586129920\n", + "rslt: 27078426624 3590324224\n", + "rslt: 27061649408 3590324224\n", + "rslt: 27061649408 3590324224\n", + "rslt: 27061649408 3594518528\n", + "rslt: 27044872192 3594518528\n", + "rslt: 27044872192 3594518528\n", + "rslt: 27044872192 3598712832\n", + "rslt: 27028094976 3598712832\n", + "rslt: 27028094976 3598712832\n", + "rslt: 27028094976 3598712832\n", + "rslt: 27011317760 3602907136\n", + "rslt: 27011317760 3602907136\n", + "rslt: 27011317760 3602907136\n", + "rslt: 26994540544 3607101440\n", + "rslt: 26994540544 3607101440\n", + "rslt: 26994540544 3607101440\n", + "rslt: 26977763328 3611295744\n", + "rslt: 26977763328 3611295744\n", + "rslt: 26977763328 3611295744\n", + "rslt: 26960986112 3615490048\n", + "rslt: 26960986112 3615490048\n", + "rslt: 26960986112 3615490048\n", + "rslt: 26944208896 3619684352\n", + "rslt: 26944208896 3619684352\n", + "rslt: 26944208896 3619684352\n", + "rslt: 26927431680 3623878656\n", + "rslt: 26927431680 3623878656\n", + "rslt: 26927431680 3623878656\n", + "rslt: 26910654464 3628072960\n", + "rslt: 26910654464 3628072960\n", + "rslt: 26910654464 3628072960\n", + "rslt: 26910654464 3628072960\n", + "rslt: 26893877248 3632267264\n", + "rslt: 26893877248 3632267264\n", + "rslt: 26893877248 3632267264\n", + "rslt: 26877100032 3636461568\n", + "rslt: 26877100032 3636461568\n", + "rslt: 26877100032 3636461568\n", + "rslt: 26860322816 3640655872\n", + "rslt: 26860322816 3640655872\n", + "rslt: 26860322816 3640655872\n", + "rslt: 26843545600 3644850176\n", + "rslt: 26843545600 3644850176\n", + "rslt: 26843545600 3644850176\n", + "rslt: 26826768384 3649044480\n", + "rslt: 26826768384 3649044480\n", + "rslt: 26826768384 3649044480\n", + "rslt: 26809991168 3653238784\n", + "rslt: 26809991168 3653238784\n", + "rslt: 26809991168 3653238784\n", + "rslt: 26793213952 3653238784\n", + "rslt: 26793213952 3657433088\n", + "rslt: 26793213952 3657433088\n", + "rslt: 26776436736 3657433088\n", + "rslt: 26776436736 3661627392\n", + "rslt: 26776436736 3661627392\n", + "rslt: 26759659520 3661627392\n", + "rslt: 26759659520 3665821696\n", + "rslt: 26759659520 3665821696\n", + "rslt: 26742882304 3665821696\n", + "rslt: 26742882304 3670016000\n", + "rslt: 26742882304 3670016000\n", + "rslt: 26726105088 3670016000\n", + "rslt: 26726105088 3674210304\n", + "rslt: 26726105088 3674210304\n", + "rslt: 26709327872 3674210304\n", + "rslt: 26709327872 3678404608\n", + "rslt: 26709327872 3678404608\n", + "rslt: 26692550656 3678404608\n", + "rslt: 26692550656 3682598912\n", + "rslt: 26692550656 3682598912\n", + "rslt: 26675773440 3682598912\n", + "rslt: 26675773440 3682598912\n", + "rslt: 26675773440 3686793216\n", + "rslt: 26658996224 3686793216\n", + "rslt: 26658996224 3686793216\n", + "rslt: 26658996224 3690987520\n", + "rslt: 26642219008 3690987520\n", + "rslt: 26642219008 3690987520\n", + "rslt: 26642219008 3695181824\n", + "rslt: 26625441792 3695181824\n", + "rslt: 26625441792 3695181824\n", + "rslt: 26625441792 3699376128\n", + "rslt: 26608664576 3699376128\n", + "rslt: 26608664576 3699376128\n", + "rslt: 26608664576 3703570432\n", + "rslt: 26591887360 3703570432\n", + "rslt: 26591887360 3703570432\n", + "rslt: 26591887360 3707764736\n", + "rslt: 26575110144 3707764736\n", + "rslt: 26575110144 3707764736\n", + "rslt: 26575110144 3711959040\n", + "rslt: 26558332928 3711959040\n", + "rslt: 26558332928 3711959040\n", + "rslt: 26558332928 3711959040\n", + "rslt: 26541555712 3716153344\n", + "rslt: 26541555712 3716153344\n", + "rslt: 26541555712 3716153344\n", + "rslt: 26524778496 3720347648\n", + "rslt: 26524778496 3720347648\n", + "rslt: 26524778496 3720347648\n", + "rslt: 26508001280 3724541952\n", + "rslt: 26508001280 3724541952\n", + "rslt: 26508001280 3724541952\n", + "rslt: 26491224064 3728736256\n", + "rslt: 26491224064 3728736256\n", + "rslt: 26491224064 3728736256\n", + "rslt: 26474446848 3732930560\n", + "rslt: 26474446848 3732930560\n", + "rslt: 26474446848 3732930560\n", + "rslt: 26457669632 3737124864\n", + "rslt: 26457669632 3737124864\n", + "rslt: 26457669632 3737124864\n", + "rslt: 26440892416 3741319168\n", + "rslt: 26440892416 3741319168\n", + "rslt: 26440892416 3741319168\n", + "rslt: 26424115200 3741319168\n", + "rslt: 26424115200 3745513472\n", + "rslt: 26424115200 3745513472\n", + "rslt: 26407337984 3745513472\n", + "rslt: 26407337984 3749707776\n", + "rslt: 26407337984 3749707776\n", + "rslt: 26390560768 3749707776\n", + "rslt: 26390560768 3753902080\n", + "rslt: 26390560768 3753902080\n", + "rslt: 26373783552 3753902080\n", + "rslt: 26373783552 3758096384\n", + "rslt: 26373783552 3758096384\n", + "rslt: 26357006336 3758096384\n", + "rslt: 26357006336 3762290688\n", + "rslt: 26357006336 3762290688\n", + "rslt: 26340229120 3762290688\n", + "rslt: 26340229120 3766484992\n", + "rslt: 26340229120 3766484992\n", + "rslt: 26323451904 3766484992\n", + "rslt: 26323451904 3770679296\n", + "rslt: 26323451904 3770679296\n", + "rslt: 26306674688 3770679296\n", + "rslt: 26306674688 3770679296\n", + "rslt: 26306674688 3774873600\n", + "rslt: 26289897472 3774873600\n", + "rslt: 26289897472 3774873600\n", + "rslt: 26289897472 3779067904\n", + "rslt: 26273120256 3779067904\n", + "rslt: 26273120256 3779067904\n", + "rslt: 26273120256 3783262208\n", + "rslt: 26256343040 3783262208\n", + "rslt: 26256343040 3783262208\n", + "rslt: 26256343040 3787456512\n", + "rslt: 26239565824 3787456512\n", + "rslt: 26239565824 3787456512\n", + "rslt: 26239565824 3791650816\n", + "rslt: 26222788608 3791650816\n", + "rslt: 26222788608 3791650816\n", + "rslt: 26222788608 3795845120\n", + "rslt: 26206011392 3795845120\n", + "rslt: 26206011392 3795845120\n", + "rslt: 26206011392 3800039424\n", + "rslt: 26189234176 3800039424\n", + "rslt: 26189234176 3800039424\n", + "rslt: 26189234176 3800039424\n", + "rslt: 26172456960 3804233728\n", + "rslt: 26172456960 3804233728\n", + "rslt: 26172456960 3804233728\n", + "rslt: 26155679744 3808428032\n", + "rslt: 26155679744 3808428032\n", + "rslt: 26155679744 3808428032\n", + "rslt: 26138902528 3812622336\n", + "rslt: 26138902528 3812622336\n", + "rslt: 26138902528 3812622336\n", + "rslt: 26122125312 3816816640\n", + "rslt: 26122125312 3816816640\n", + "rslt: 26122125312 3816816640\n", + "rslt: 26105348096 3821010944\n", + "rslt: 26105348096 3821010944\n", + "rslt: 26105348096 3821010944\n", + "rslt: 26088570880 3825205248\n", + "rslt: 26088570880 3825205248\n", + "rslt: 26088570880 3825205248\n", + "rslt: 26071793664 3829399552\n", + "rslt: 26071793664 3829399552\n", + "rslt: 26071793664 3829399552\n", + "rslt: 26055016448 3829399552\n", + "rslt: 26055016448 3833593856\n", + "rslt: 26055016448 3833593856\n", + "rslt: 26038239232 3833593856\n", + "rslt: 26038239232 3837788160\n", + "rslt: 26038239232 3837788160\n", + "rslt: 26021462016 3837788160\n", + "rslt: 26021462016 3841982464\n", + "rslt: 26021462016 3841982464\n", + "rslt: 26004684800 3841982464\n", + "rslt: 26004684800 3846176768\n", + "rslt: 26004684800 3846176768\n", + "rslt: 25987907584 3846176768\n", + "rslt: 25987907584 3850371072\n", + "rslt: 25987907584 3850371072\n", + "rslt: 25971130368 3850371072\n", + "rslt: 25971130368 3854565376\n", + "rslt: 25971130368 3854565376\n", + "rslt: 25954353152 3854565376\n", + "rslt: 25954353152 3854565376\n", + "rslt: 25954353152 3858759680\n", + "rslt: 25937575936 3858759680\n", + "rslt: 25937575936 3858759680\n", + "rslt: 25937575936 3862953984\n", + "rslt: 25920798720 3862953984\n", + "rslt: 25920798720 3862953984\n", + "rslt: 25920798720 3867148288\n", + "rslt: 25904021504 3867148288\n", + "rslt: 25904021504 3867148288\n", + "rslt: 25904021504 3871342592\n", + "rslt: 25887244288 3871342592\n", + "rslt: 25887244288 3871342592\n", + "rslt: 25887244288 3875536896\n", + "rslt: 25870467072 3875536896\n", + "rslt: 25870467072 3875536896\n", + "rslt: 25870467072 3879731200\n", + "rslt: 25853689856 3879731200\n", + "rslt: 25853689856 3879731200\n", + "rslt: 25853689856 3883925504\n", + "rslt: 25836912640 3883925504\n", + "rslt: 25836912640 3883925504\n", + "rslt: 25836912640 3883925504\n", + "rslt: 25820135424 3888119808\n", + "rslt: 25820135424 3888119808\n", + "rslt: 25820135424 3888119808\n", + "rslt: 25803358208 3892314112\n", + "rslt: 25803358208 3892314112\n", + "rslt: 25803358208 3892314112\n", + "rslt: 25786580992 3896508416\n", + "rslt: 25786580992 3896508416\n", + "rslt: 25786580992 3896508416\n", + "rslt: 25769803776 3900702720\n", + "rslt: 25769803776 3900702720\n", + "rslt: 25769803776 3900702720\n", + "rslt: 25753026560 3904897024\n", + "rslt: 25753026560 3904897024\n", + "rslt: 25753026560 3904897024\n", + "rslt: 25753026560 3909091328\n", + "rslt: 25736249344 3909091328\n", + "rslt: 25736249344 3909091328\n", + "rslt: 25736249344 3913285632\n", + "rslt: 25719472128 3913285632\n", + "rslt: 25719472128 3913285632\n", + "rslt: 25719472128 3913285632\n", + "rslt: 25702694912 3917479936\n", + "rslt: 25702694912 3917479936\n", + "rslt: 25702694912 3917479936\n", + "rslt: 25685917696 3921674240\n", + "rslt: 25685917696 3921674240\n", + "rslt: 25685917696 3921674240\n", + "rslt: 25669140480 3925868544\n", + "rslt: 25669140480 3925868544\n", + "rslt: 25669140480 3925868544\n", + "rslt: 25652363264 3930062848\n", + "rslt: 25652363264 3930062848\n", + "rslt: 25652363264 3930062848\n", + "rslt: 25635586048 3934257152\n", + "rslt: 25635586048 3934257152\n", + "rslt: 25635586048 3934257152\n", + "rslt: 25618808832 3938451456\n", + "rslt: 25618808832 3938451456\n", + "rslt: 25618808832 3938451456\n", + "rslt: 25602031616 3942645760\n", + "rslt: 25602031616 3942645760\n", + "rslt: 25602031616 3942645760\n", + "rslt: 25585254400 3942645760\n", + "rslt: 25585254400 3946840064\n", + "rslt: 25585254400 3946840064\n", + "rslt: 25568477184 3946840064\n", + "rslt: 25568477184 3951034368\n", + "rslt: 25568477184 3951034368\n", + "rslt: 25551699968 3951034368\n", + "rslt: 25551699968 3955228672\n", + "rslt: 25551699968 3955228672\n", + "rslt: 25534922752 3955228672\n", + "rslt: 25534922752 3959422976\n", + "rslt: 25534922752 3959422976\n", + "rslt: 25518145536 3959422976\n", + "rslt: 25518145536 3963617280\n", + "rslt: 25518145536 3963617280\n", + "rslt: 25501368320 3963617280\n", + "rslt: 25501368320 3967811584\n", + "rslt: 25501368320 3967811584\n", + "rslt: 25484591104 3967811584\n", + "rslt: 25484591104 3972005888\n", + "rslt: 25484591104 3972005888\n", + "rslt: 25467813888 3972005888\n", + "rslt: 25467813888 3972005888\n", + "rslt: 25467813888 3976200192\n", + "rslt: 25451036672 3976200192\n", + "rslt: 25451036672 3976200192\n", + "rslt: 25451036672 3980394496\n", + "rslt: 25434259456 3980394496\n", + "rslt: 25434259456 3980394496\n", + "rslt: 25434259456 3984588800\n", + "rslt: 25417482240 3984588800\n", + "rslt: 25417482240 3984588800\n", + "rslt: 25417482240 3988783104\n", + "rslt: 25400705024 3988783104\n", + "rslt: 25400705024 3988783104\n", + "rslt: 25400705024 3992977408\n", + "rslt: 25383927808 3992977408\n", + "rslt: 25383927808 3992977408\n", + "rslt: 25383927808 3997171712\n", + "rslt: 25367150592 3997171712\n", + "rslt: 25367150592 3997171712\n", + "rslt: 25367150592 4001366016\n", + "rslt: 25350373376 4001366016\n", + "rslt: 25350373376 4001366016\n", + "rslt: 25350373376 4001366016\n", + "rslt: 25333596160 4005560320\n", + "rslt: 25333596160 4005560320\n", + "rslt: 25333596160 4005560320\n", + "rslt: 25316818944 4009754624\n", + "rslt: 25316818944 4009754624\n", + "rslt: 25316818944 4009754624\n", + "rslt: 25300041728 4013948928\n", + "rslt: 25300041728 4013948928\n", + "rslt: 25300041728 4013948928\n", + "rslt: 25283264512 4018143232\n", + "rslt: 25283264512 4018143232\n", + "rslt: 25283264512 4018143232\n", + "rslt: 25266487296 4022337536\n", + "rslt: 25266487296 4022337536\n", + "rslt: 25266487296 4022337536\n", + "rslt: 25249710080 4026531840\n", + "rslt: 25249710080 4026531840\n", + "rslt: 25249710080 4026531840\n", + "rslt: 25232932864 4030726144\n", + "rslt: 25232932864 4030726144\n", + "rslt: 25232932864 4030726144\n", + "rslt: 25216155648 4030726144\n", + "rslt: 25216155648 4034920448\n", + "rslt: 25216155648 4034920448\n", + "rslt: 25199378432 4034920448\n", + "rslt: 25199378432 4039114752\n", + "rslt: 25199378432 4039114752\n", + "rslt: 25182601216 4039114752\n", + "rslt: 25182601216 4043309056\n", + "rslt: 25182601216 4043309056\n", + "rslt: 25165824000 4043309056\n", + "rslt: 25165824000 4047503360\n", + "rslt: 25165824000 4047503360\n", + "rslt: 25149046784 4047503360\n", + "rslt: 25149046784 4051697664\n", + "rslt: 25149046784 4051697664\n", + "rslt: 25132269568 4051697664\n", + "rslt: 25132269568 4055891968\n", + "rslt: 25132269568 4055891968\n", + "rslt: 25115492352 4055891968\n", + "rslt: 25115492352 4055891968\n", + "rslt: 25115492352 4060086272\n", + "rslt: 25098715136 4060086272\n", + "rslt: 25098715136 4060086272\n", + "rslt: 25098715136 4064280576\n", + "rslt: 25081937920 4064280576\n", + "rslt: 25081937920 4064280576\n", + "rslt: 25081937920 4068474880\n", + "rslt: 25065160704 4068474880\n", + "rslt: 25065160704 4068474880\n", + "rslt: 25065160704 4072669184\n", + "rslt: 25048383488 4072669184\n", + "rslt: 25048383488 4072669184\n", + "rslt: 25048383488 4076863488\n", + "rslt: 25031606272 4076863488\n", + "rslt: 25031606272 4076863488\n", + "rslt: 25031606272 4081057792\n", + "rslt: 25014829056 4081057792\n", + "rslt: 25014829056 4081057792\n", + "rslt: 25014829056 4085252096\n", + "rslt: 24998051840 4085252096\n", + "rslt: 24998051840 4085252096\n", + "rslt: 24998051840 4085252096\n", + "rslt: 24981274624 4089446400\n", + "rslt: 24981274624 4089446400\n", + "rslt: 24981274624 4089446400\n", + "rslt: 24964497408 4093640704\n", + "rslt: 24964497408 4093640704\n", + "rslt: 24964497408 4093640704\n", + "rslt: 24947720192 4097835008\n", + "rslt: 24947720192 4097835008\n", + "rslt: 24947720192 4097835008\n", + "rslt: 24930942976 4102029312\n", + "rslt: 24930942976 4102029312\n", + "rslt: 24930942976 4102029312\n", + "rslt: 24914165760 4106223616\n", + "rslt: 24914165760 4106223616\n", + "rslt: 24914165760 4106223616\n", + "rslt: 24897388544 4110417920\n", + "rslt: 24897388544 4110417920\n", + "rslt: 24897388544 4110417920\n", + "rslt: 24880611328 4114612224\n", + "rslt: 24880611328 4114612224\n", + "rslt: 24880611328 4114612224\n", + "rslt: 24863834112 4114612224\n", + "rslt: 24863834112 4118806528\n", + "rslt: 24863834112 4118806528\n", + "rslt: 24847056896 4118806528\n", + "rslt: 24847056896 4123000832\n", + "rslt: 24847056896 4123000832\n", + "rslt: 24830279680 4123000832\n", + "rslt: 24830279680 4127195136\n", + "rslt: 24830279680 4127195136\n", + "rslt: 24813502464 4127195136\n", + "rslt: 24813502464 4131389440\n", + "rslt: 24813502464 4131389440\n", + "rslt: 24796725248 4131389440\n", + "rslt: 24796725248 4135583744\n", + "rslt: 24796725248 4135583744\n", + "rslt: 24779948032 4135583744\n", + "rslt: 24779948032 4139778048\n", + "rslt: 24779948032 4139778048\n", + "rslt: 24763170816 4139778048\n", + "rslt: 24763170816 4143972352\n", + "rslt: 24763170816 4143972352\n", + "rslt: 24746393600 4143972352\n", + "rslt: 24746393600 4143972352\n", + "rslt: 24746393600 4148166656\n", + "rslt: 24729616384 4148166656\n", + "rslt: 24729616384 4148166656\n", + "rslt: 24729616384 4152360960\n", + "rslt: 24712839168 4152360960\n", + "rslt: 24712839168 4152360960\n", + "rslt: 24712839168 4156555264\n", + "rslt: 24696061952 4156555264\n", + "rslt: 24696061952 4156555264\n", + "rslt: 24696061952 4160749568\n", + "rslt: 24679284736 4160749568\n", + "rslt: 24679284736 4160749568\n", + "rslt: 24679284736 4164943872\n", + "rslt: 24662507520 4164943872\n", + "rslt: 24662507520 4164943872\n", + "rslt: 24662507520 4169138176\n", + "rslt: 24645730304 4169138176\n", + "rslt: 24645730304 4169138176\n", + "rslt: 24645730304 4173332480\n", + "rslt: 24628953088 4173332480\n", + "rslt: 24628953088 4173332480\n", + "rslt: 24628953088 4173332480\n", + "rslt: 24612175872 4177526784\n", + "rslt: 24612175872 4177526784\n", + "rslt: 24612175872 4177526784\n", + "rslt: 24595398656 4181721088\n", + "rslt: 24595398656 4181721088\n", + "rslt: 24595398656 4181721088\n", + "rslt: 24578621440 4185915392\n", + "rslt: 24578621440 4185915392\n", + "rslt: 24578621440 4185915392\n", + "rslt: 24578621440 4190109696\n", + "rslt: 24561844224 4190109696\n", + "rslt: 24561844224 4190109696\n", + "rslt: 24561844224 4194304000\n", + "rslt: 24545067008 4194304000\n", + "rslt: 24545067008 4194304000\n", + "rslt: 24545067008 4198498304\n", + "rslt: 24528289792 4198498304\n", + "rslt: 24528289792 4198498304\n", + "rslt: 24528289792 4202692608\n", + "rslt: 24511512576 4202692608\n", + "rslt: 24511512576 4202692608\n", + "rslt: 24511512576 4202692608\n", + "rslt: 24494735360 4206886912\n", + "rslt: 24494735360 4206886912\n", + "rslt: 24494735360 4206886912\n", + "rslt: 24477958144 4211081216\n", + "rslt: 24477958144 4211081216\n", + "rslt: 24477958144 4211081216\n", + "rslt: 24461180928 4215275520\n", + "rslt: 24461180928 4215275520\n", + "rslt: 24461180928 4215275520\n", + "rslt: 24444403712 4219469824\n", + "rslt: 24444403712 4219469824\n", + "rslt: 24444403712 4219469824\n", + "rslt: 24427626496 4223664128\n", + "rslt: 24427626496 4223664128\n", + "rslt: 24427626496 4223664128\n", + "rslt: 24410849280 4227858432\n", + "rslt: 24410849280 4227858432\n", + "rslt: 24410849280 4227858432\n", + "rslt: 24394072064 4232052736\n", + "rslt: 24394072064 4232052736\n", + "rslt: 24394072064 4232052736\n", + "rslt: 24377294848 4232052736\n", + "rslt: 24377294848 4236247040\n", + "rslt: 24377294848 4236247040\n", + "rslt: 24360517632 4236247040\n", + "rslt: 24360517632 4240441344\n", + "rslt: 24360517632 4240441344\n", + "rslt: 24343740416 4240441344\n", + "rslt: 24343740416 4244635648\n", + "rslt: 24343740416 4244635648\n", + "rslt: 24326963200 4244635648\n", + "rslt: 24326963200 4248829952\n", + "rslt: 24326963200 4248829952\n", + "rslt: 24310185984 4248829952\n", + "rslt: 24310185984 4253024256\n", + "rslt: 24310185984 4253024256\n", + "rslt: 24293408768 4253024256\n", + "rslt: 24293408768 4257218560\n", + "rslt: 24293408768 4257218560\n", + "rslt: 24276631552 4257218560\n", + "rslt: 24276631552 4257218560\n", + "rslt: 24276631552 4261412864\n", + "rslt: 24259854336 4261412864\n", + "rslt: 24259854336 4261412864\n", + "rslt: 24259854336 4265607168\n", + "rslt: 24243077120 4265607168\n", + "rslt: 24243077120 4265607168\n", + "rslt: 24243077120 4269801472\n", + "rslt: 24226299904 4269801472\n", + "rslt: 24226299904 4269801472\n", + "rslt: 24226299904 4273995776\n", + "rslt: 24209522688 4273995776\n", + "rslt: 24209522688 4273995776\n", + "rslt: 24209522688 4278190080\n", + "rslt: 24192745472 4278190080\n", + "rslt: 24192745472 4278190080\n", + "rslt: 24192745472 4282384384\n", + "rslt: 24175968256 4282384384\n", + "rslt: 24175968256 4282384384\n", + "rslt: 24175968256 4286578688\n", + "rslt: 24159191040 4286578688\n", + "rslt: 24159191040 4286578688\n", + "rslt: 24159191040 4286578688\n", + "rslt: 24142413824 4290772992\n", + "rslt: 24142413824 4290772992\n", + "rslt: 24142413824 4290772992\n", + "rslt: 24125636608 4294967296\n", + "rslt: 24125636608 4294967296\n", + "rslt: 24125636608 4294967296\n", + "rslt: 24108859392 4299161600\n", + "rslt: 24108859392 4299161600\n", + "rslt: 24108859392 4299161600\n", + "rslt: 24092082176 4303355904\n", + "rslt: 24092082176 4303355904\n", + "rslt: 24092082176 4303355904\n", + "rslt: 24075304960 4307550208\n", + "rslt: 24075304960 4307550208\n", + "rslt: 24075304960 4307550208\n", + "rslt: 24058527744 4311744512\n", + "rslt: 24058527744 4311744512\n", + "rslt: 24058527744 4311744512\n", + "rslt: 24041750528 4315938816\n", + "rslt: 24041750528 4315938816\n", + "rslt: 24041750528 4315938816\n", + "rslt: 24024973312 4315938816\n", + "rslt: 24024973312 4320133120\n", + "rslt: 24024973312 4320133120\n", + "rslt: 24008196096 4320133120\n", + "rslt: 24008196096 4324327424\n", + "rslt: 24008196096 4324327424\n", + "rslt: 23991418880 4324327424\n", + "rslt: 23991418880 4328521728\n", + "rslt: 23991418880 4328521728\n", + "rslt: 23974641664 4328521728\n", + "rslt: 23974641664 4332716032\n", + "rslt: 23974641664 4332716032\n", + "rslt: 23957864448 4332716032\n", + "rslt: 23957864448 4336910336\n", + "rslt: 23957864448 4336910336\n", + "rslt: 23941087232 4336910336\n", + "rslt: 23941087232 4341104640\n", + "rslt: 23941087232 4341104640\n", + "rslt: 23924310016 4341104640\n", + "rslt: 23924310016 4345298944\n", + "rslt: 23924310016 4345298944\n", + "rslt: 23907532800 4345298944\n", + "rslt: 23907532800 4345298944\n", + "rslt: 23907532800 4349493248\n", + "rslt: 23890755584 4349493248\n", + "rslt: 23890755584 4349493248\n", + "rslt: 23890755584 4353687552\n", + "rslt: 23873978368 4353687552\n", + "rslt: 23873978368 4353687552\n", + "rslt: 23873978368 4357881856\n", + "rslt: 23857201152 4357881856\n", + "rslt: 23857201152 4357881856\n", + "rslt: 23857201152 4362076160\n", + "rslt: 23840423936 4362076160\n", + "rslt: 23840423936 4362076160\n", + "rslt: 23840423936 4366270464\n", + "rslt: 23823646720 4366270464\n", + "rslt: 23823646720 4366270464\n", + "rslt: 23823646720 4370464768\n", + "rslt: 23806869504 4370464768\n", + "rslt: 23806869504 4370464768\n", + "rslt: 23806869504 4374659072\n", + "rslt: 23790092288 4374659072\n", + "rslt: 23790092288 4374659072\n", + "rslt: 23790092288 4374659072\n", + "rslt: 23773315072 4378853376\n", + "rslt: 23773315072 4378853376\n", + "rslt: 23773315072 4378853376\n", + "rslt: 23756537856 4383047680\n", + "rslt: 23756537856 4383047680\n", + "rslt: 23756537856 4383047680\n", + "rslt: 23739760640 4387241984\n", + "rslt: 23739760640 4387241984\n", + "rslt: 23739760640 4387241984\n", + "rslt: 23722983424 4391436288\n", + "rslt: 23722983424 4391436288\n", + "rslt: 23722983424 4391436288\n", + "rslt: 23706206208 4395630592\n", + "rslt: 23706206208 4395630592\n", + "rslt: 23706206208 4395630592\n", + "rslt: 23689428992 4399824896\n", + "rslt: 23689428992 4399824896\n", + "rslt: 23689428992 4399824896\n", + "rslt: 23672651776 4404019200\n", + "rslt: 23672651776 4404019200\n", + "rslt: 23672651776 4404019200\n", + "rslt: 23655874560 4404019200\n", + "rslt: 23655874560 4408213504\n", + "rslt: 23655874560 4408213504\n", + "rslt: 23639097344 4408213504\n", + "rslt: 23639097344 4412407808\n", + "rslt: 23639097344 4412407808\n", + "rslt: 23622320128 4412407808\n", + "rslt: 23622320128 4416602112\n", + "rslt: 23622320128 4416602112\n", + "rslt: 23605542912 4416602112\n", + "rslt: 23605542912 4420796416\n", + "rslt: 23605542912 4420796416\n", + "rslt: 23588765696 4420796416\n", + "rslt: 23588765696 4424990720\n", + "rslt: 23588765696 4424990720\n", + "rslt: 23571988480 4424990720\n", + "rslt: 23571988480 4429185024\n", + "rslt: 23571988480 4429185024\n", + "rslt: 23555211264 4429185024\n", + "rslt: 23555211264 4433379328\n", + "rslt: 23555211264 4433379328\n", + "rslt: 23538434048 4433379328\n", + "rslt: 23538434048 4433379328\n", + "rslt: 23538434048 4437573632\n", + "rslt: 23521656832 4437573632\n", + "rslt: 23521656832 4437573632\n", + "rslt: 23521656832 4441767936\n", + "rslt: 23504879616 4441767936\n", + "rslt: 23504879616 4441767936\n", + "rslt: 23504879616 4445962240\n", + "rslt: 23488102400 4445962240\n", + "rslt: 23488102400 4445962240\n", + "rslt: 23488102400 4450156544\n", + "rslt: 23471325184 4450156544\n", + "rslt: 23471325184 4450156544\n", + "rslt: 23471325184 4454350848\n", + "rslt: 23454547968 4454350848\n", + "rslt: 23454547968 4454350848\n", + "rslt: 23454547968 4458545152\n", + "rslt: 23437770752 4458545152\n", + "rslt: 23437770752 4458545152\n", + "rslt: 23437770752 4458545152\n", + "rslt: 23420993536 4462739456\n", + "rslt: 23420993536 4462739456\n", + "rslt: 23420993536 4462739456\n", + "rslt: 23420993536 4466933760\n", + "rslt: 23404216320 4466933760\n", + "rslt: 23404216320 4466933760\n", + "rslt: 23404216320 4471128064\n", + "rslt: 23387439104 4471128064\n", + "rslt: 23387439104 4471128064\n", + "rslt: 23387439104 4475322368\n", + "rslt: 23370661888 4475322368\n", + "rslt: 23370661888 4475322368\n", + "rslt: 23370661888 4479516672\n", + "rslt: 23353884672 4479516672\n", + "rslt: 23353884672 4479516672\n", + "rslt: 23353884672 4483710976\n", + "rslt: 23337107456 4483710976\n", + "rslt: 23337107456 4483710976\n", + "rslt: 23337107456 4487905280\n", + "rslt: 23320330240 4487905280\n", + "rslt: 23320330240 4487905280\n", + "rslt: 23320330240 4487905280\n", + "rslt: 23303553024 4492099584\n", + "rslt: 23303553024 4492099584\n", + "rslt: 23303553024 4492099584\n", + "rslt: 23286775808 4496293888\n", + "rslt: 23286775808 4496293888\n", + "rslt: 23286775808 4496293888\n", + "rslt: 23269998592 4500488192\n", + "rslt: 23269998592 4500488192\n", + "rslt: 23269998592 4500488192\n", + "rslt: 23253221376 4504682496\n", + "rslt: 23253221376 4504682496\n", + "rslt: 23253221376 4504682496\n", + "rslt: 23236444160 4508876800\n", + "rslt: 23236444160 4508876800\n", + "rslt: 23236444160 4508876800\n", + "rslt: 23219666944 4513071104\n", + "rslt: 23219666944 4513071104\n", + "rslt: 23219666944 4513071104\n", + "rslt: 23202889728 4517265408\n", + "rslt: 23202889728 4517265408\n", + "rslt: 23202889728 4517265408\n", + "rslt: 23186112512 4517265408\n", + "rslt: 23186112512 4521459712\n", + "rslt: 23186112512 4521459712\n", + "rslt: 23169335296 4521459712\n", + "rslt: 23169335296 4525654016\n", + "rslt: 23169335296 4525654016\n", + "rslt: 23152558080 4525654016\n", + "rslt: 23152558080 4529848320\n", + "rslt: 23152558080 4529848320\n", + "rslt: 23135780864 4529848320\n", + "rslt: 23135780864 4534042624\n", + "rslt: 23135780864 4534042624\n", + "rslt: 23119003648 4534042624\n", + "rslt: 23119003648 4538236928\n", + "rslt: 23119003648 4538236928\n", + "rslt: 23102226432 4538236928\n", + "rslt: 23102226432 4542431232\n", + "rslt: 23102226432 4542431232\n", + "rslt: 23085449216 4542431232\n", + "rslt: 23085449216 4546625536\n", + "rslt: 23085449216 4546625536\n", + "rslt: 23068672000 4546625536\n", + "rslt: 23068672000 4546625536\n", + "rslt: 23068672000 4550819840\n", + "rslt: 23051894784 4550819840\n", + "rslt: 23051894784 4550819840\n", + "rslt: 23051894784 4555014144\n", + "rslt: 23035117568 4555014144\n", + "rslt: 23035117568 4555014144\n", + "rslt: 23035117568 4559208448\n", + "rslt: 23018340352 4559208448\n", + "rslt: 23018340352 4559208448\n", + "rslt: 23018340352 4563402752\n", + "rslt: 23001563136 4563402752\n", + "rslt: 23001563136 4563402752\n", + "rslt: 23001563136 4567597056\n", + "rslt: 22984785920 4567597056\n", + "rslt: 22984785920 4567597056\n", + "rslt: 22984785920 4571791360\n", + "rslt: 22968008704 4571791360\n", + "rslt: 22968008704 4571791360\n", + "rslt: 22968008704 4575985664\n", + "rslt: 22951231488 4575985664\n", + "rslt: 22951231488 4575985664\n", + "rslt: 22951231488 4575985664\n", + "rslt: 22934454272 4580179968\n", + "rslt: 22934454272 4580179968\n", + "rslt: 22934454272 4580179968\n", + "rslt: 22917677056 4584374272\n", + "rslt: 22917677056 4584374272\n", + "rslt: 22917677056 4584374272\n", + "rslt: 22900899840 4588568576\n", + "rslt: 22900899840 4588568576\n", + "rslt: 22900899840 4588568576\n", + "rslt: 22884122624 4592762880\n", + "rslt: 22884122624 4592762880\n", + "rslt: 22884122624 4592762880\n", + "rslt: 22867345408 4596957184\n", + "rslt: 22867345408 4596957184\n", + "rslt: 22867345408 4596957184\n", + "rslt: 22850568192 4601151488\n", + "rslt: 22850568192 4601151488\n", + "rslt: 22850568192 4601151488\n", + "rslt: 22833790976 4605345792\n", + "rslt: 22833790976 4605345792\n", + "rslt: 22833790976 4605345792\n", + "rslt: 22817013760 4605345792\n", + "rslt: 22817013760 4609540096\n", + "rslt: 22817013760 4609540096\n", + "rslt: 22800236544 4609540096\n", + "rslt: 22800236544 4613734400\n", + "rslt: 22800236544 4613734400\n", + "rslt: 22783459328 4613734400\n", + "rslt: 22783459328 4617928704\n", + "rslt: 22783459328 4617928704\n", + "rslt: 22766682112 4617928704\n", + "rslt: 22766682112 4622123008\n", + "rslt: 22766682112 4622123008\n", + "rslt: 22749904896 4622123008\n", + "rslt: 22749904896 4626317312\n", + "rslt: 22749904896 4626317312\n", + "rslt: 22733127680 4626317312\n", + "rslt: 22733127680 4630511616\n", + "rslt: 22733127680 4630511616\n", + "rslt: 22716350464 4630511616\n", + "rslt: 22716350464 4634705920\n", + "rslt: 22716350464 4634705920\n", + "rslt: 22699573248 4634705920\n", + "rslt: 22699573248 4634705920\n", + "rslt: 22699573248 4638900224\n", + "rslt: 22682796032 4638900224\n", + "rslt: 22682796032 4638900224\n", + "rslt: 22682796032 4643094528\n", + "rslt: 22666018816 4643094528\n", + "rslt: 22666018816 4643094528\n", + "rslt: 22666018816 4647288832\n", + "rslt: 22649241600 4647288832\n", + "rslt: 22649241600 4647288832\n", + "rslt: 22649241600 4651483136\n", + "rslt: 22632464384 4651483136\n", + "rslt: 22632464384 4651483136\n", + "rslt: 22632464384 4655677440\n", + "rslt: 22615687168 4655677440\n", + "rslt: 22615687168 4655677440\n", + "rslt: 22615687168 4659871744\n", + "rslt: 22598909952 4659871744\n", + "rslt: 22598909952 4659871744\n", + "rslt: 22598909952 4664066048\n", + "rslt: 22582132736 4664066048\n", + "rslt: 22582132736 4664066048\n", + "rslt: 22582132736 4664066048\n", + "rslt: 22565355520 4668260352\n", + "rslt: 22565355520 4668260352\n", + "rslt: 22565355520 4668260352\n", + "rslt: 22548578304 4672454656\n", + "rslt: 22548578304 4672454656\n", + "rslt: 22548578304 4672454656\n", + "rslt: 22531801088 4676648960\n", + "rslt: 22531801088 4676648960\n", + "rslt: 22531801088 4676648960\n", + "rslt: 22515023872 4680843264\n", + "rslt: 22515023872 4680843264\n", + "rslt: 22515023872 4680843264\n", + "rslt: 22498246656 4685037568\n", + "rslt: 22498246656 4685037568\n", + "rslt: 22498246656 4685037568\n", + "rslt: 22481469440 4689231872\n", + "rslt: 22481469440 4689231872\n", + "rslt: 22481469440 4689231872\n", + "rslt: 22464692224 4689231872\n", + "rslt: 22464692224 4693426176\n", + "rslt: 22464692224 4693426176\n", + "rslt: 22447915008 4693426176\n", + "rslt: 22447915008 4697620480\n", + "rslt: 22447915008 4697620480\n", + "rslt: 22431137792 4697620480\n", + "rslt: 22431137792 4701814784\n", + "rslt: 22431137792 4701814784\n", + "rslt: 22414360576 4701814784\n", + "rslt: 22414360576 4706009088\n", + "rslt: 22414360576 4706009088\n", + "rslt: 22397583360 4706009088\n", + "rslt: 22397583360 4710203392\n", + "rslt: 22397583360 4710203392\n", + "rslt: 22380806144 4710203392\n", + "rslt: 22380806144 4714397696\n", + "rslt: 22380806144 4714397696\n", + "rslt: 22364028928 4714397696\n", + "rslt: 22364028928 4718592000\n", + "rslt: 22364028928 4718592000\n", + "rslt: 22347251712 4718592000\n", + "rslt: 22347251712 4718592000\n", + "rslt: 22347251712 4722786304\n", + "rslt: 22330474496 4722786304\n", + "rslt: 22330474496 4722786304\n", + "rslt: 22330474496 4726980608\n", + "rslt: 22313697280 4726980608\n", + "rslt: 22313697280 4726980608\n", + "rslt: 22313697280 4731174912\n", + "rslt: 22296920064 4731174912\n", + "rslt: 22296920064 4731174912\n", + "rslt: 22296920064 4735369216\n", + "rslt: 22280142848 4735369216\n", + "rslt: 22280142848 4735369216\n", + "rslt: 22280142848 4739563520\n", + "rslt: 22263365632 4739563520\n", + "rslt: 22263365632 4739563520\n", + "rslt: 22263365632 4743757824\n", + "rslt: 22246588416 4743757824\n", + "rslt: 22246588416 4743757824\n", + "rslt: 22246588416 4747952128\n", + "rslt: 22246588416 4747952128\n", + "rslt: 22229811200 4747952128\n", + "rslt: 22229811200 4747952128\n", + "rslt: 22229811200 4752146432\n", + "rslt: 22213033984 4752146432\n", + "rslt: 22213033984 4752146432\n", + "rslt: 22213033984 4756340736\n", + "rslt: 22196256768 4756340736\n", + "rslt: 22196256768 4756340736\n", + "rslt: 22196256768 4760535040\n", + "rslt: 22179479552 4760535040\n", + "rslt: 22179479552 4760535040\n", + "rslt: 22179479552 4764729344\n", + "rslt: 22162702336 4764729344\n", + "rslt: 22162702336 4764729344\n", + "rslt: 22162702336 4768923648\n", + "rslt: 22145925120 4768923648\n", + "rslt: 22145925120 4768923648\n", + "rslt: 22145925120 4773117952\n", + "rslt: 22129147904 4773117952\n", + "rslt: 22129147904 4773117952\n", + "rslt: 22129147904 4777312256\n", + "rslt: 22112370688 4777312256\n", + "rslt: 22112370688 4777312256\n", + "rslt: 22112370688 4777312256\n", + "rslt: 22095593472 4781506560\n", + "rslt: 22095593472 4781506560\n", + "rslt: 22095593472 4781506560\n", + "rslt: 22078816256 4785700864\n", + "rslt: 22078816256 4785700864\n", + "rslt: 22078816256 4785700864\n", + "rslt: 22062039040 4789895168\n", + "rslt: 22062039040 4789895168\n", + "rslt: 22062039040 4789895168\n", + "rslt: 22045261824 4794089472\n", + "rslt: 22045261824 4794089472\n", + "rslt: 22045261824 4794089472\n", + "rslt: 22028484608 4798283776\n", + "rslt: 22028484608 4798283776\n", + "rslt: 22028484608 4798283776\n", + "rslt: 22011707392 4802478080\n", + "rslt: 22011707392 4802478080\n", + "rslt: 22011707392 4802478080\n", + "rslt: 21994930176 4806672384\n", + "rslt: 21994930176 4806672384\n", + "rslt: 21994930176 4806672384\n", + "rslt: 21978152960 4806672384\n", + "rslt: 21978152960 4810866688\n", + "rslt: 21978152960 4810866688\n", + "rslt: 21961375744 4810866688\n", + "rslt: 21961375744 4815060992\n", + "rslt: 21961375744 4815060992\n", + "rslt: 21944598528 4815060992\n", + "rslt: 21944598528 4819255296\n", + "rslt: 21944598528 4819255296\n", + "rslt: 21927821312 4819255296\n", + "rslt: 21927821312 4823449600\n", + "rslt: 21927821312 4823449600\n", + "rslt: 21911044096 4823449600\n", + "rslt: 21911044096 4827643904\n", + "rslt: 21911044096 4827643904\n", + "rslt: 21894266880 4827643904\n", + "rslt: 21894266880 4831838208\n", + "rslt: 21894266880 4831838208\n", + "rslt: 21877489664 4831838208\n", + "rslt: 21877489664 4836032512\n", + "rslt: 21877489664 4836032512\n", + "rslt: 21860712448 4836032512\n", + "rslt: 21860712448 4836032512\n", + "rslt: 21860712448 4840226816\n", + "rslt: 21843935232 4840226816\n", + "rslt: 21843935232 4840226816\n", + "rslt: 21843935232 4844421120\n", + "rslt: 21827158016 4844421120\n", + "rslt: 21827158016 4844421120\n", + "rslt: 21827158016 4848615424\n", + "rslt: 21810380800 4848615424\n", + "rslt: 21810380800 4848615424\n", + "rslt: 21810380800 4852809728\n", + "rslt: 21793603584 4852809728\n", + "rslt: 21793603584 4852809728\n", + "rslt: 21793603584 4857004032\n", + "rslt: 21776826368 4857004032\n", + "rslt: 21776826368 4857004032\n", + "rslt: 21776826368 4861198336\n", + "rslt: 21760049152 4861198336\n", + "rslt: 21760049152 4861198336\n", + "rslt: 21760049152 4865392640\n", + "rslt: 21743271936 4865392640\n", + "rslt: 21743271936 4865392640\n", + "rslt: 21743271936 4865392640\n", + "rslt: 21726494720 4869586944\n", + "rslt: 21726494720 4869586944\n", + "rslt: 21726494720 4869586944\n", + "rslt: 21709717504 4873781248\n", + "rslt: 21709717504 4873781248\n", + "rslt: 21709717504 4873781248\n", + "rslt: 21692940288 4877975552\n", + "rslt: 21692940288 4877975552\n", + "rslt: 21692940288 4877975552\n", + "rslt: 21676163072 4882169856\n", + "rslt: 21676163072 4882169856\n", + "rslt: 21676163072 4882169856\n", + "rslt: 21659385856 4886364160\n", + "rslt: 21659385856 4886364160\n", + "rslt: 21659385856 4886364160\n", + "rslt: 21642608640 4890558464\n", + "rslt: 21642608640 4890558464\n", + "rslt: 21642608640 4890558464\n", + "rslt: 21625831424 4890558464\n", + "rslt: 21625831424 4894752768\n", + "rslt: 21625831424 4894752768\n", + "rslt: 21609054208 4894752768\n", + "rslt: 21609054208 4898947072\n", + "rslt: 21609054208 4898947072\n", + "rslt: 21592276992 4898947072\n", + "rslt: 21592276992 4903141376\n", + "rslt: 21592276992 4903141376\n", + "rslt: 21575499776 4903141376\n", + "rslt: 21575499776 4907335680\n", + "rslt: 21575499776 4907335680\n", + "rslt: 21558722560 4907335680\n", + "rslt: 21558722560 4911529984\n", + "rslt: 21558722560 4911529984\n", + "rslt: 21541945344 4911529984\n", + "rslt: 21541945344 4915724288\n", + "rslt: 21541945344 4915724288\n", + "rslt: 21525168128 4915724288\n", + "rslt: 21525168128 4919918592\n", + "rslt: 21525168128 4919918592\n", + "rslt: 21508390912 4919918592\n", + "rslt: 21508390912 4919918592\n", + "rslt: 21508390912 4924112896\n", + "rslt: 21491613696 4924112896\n", + "rslt: 21491613696 4924112896\n", + "rslt: 21491613696 4928307200\n", + "rslt: 21474836480 4928307200\n", + "rslt: 21474836480 4928307200\n", + "rslt: 21474836480 4932501504\n", + "rslt: 21458059264 4932501504\n", + "rslt: 21458059264 4932501504\n", + "rslt: 21458059264 4936695808\n", + "rslt: 21441282048 4936695808\n", + "rslt: 21441282048 4936695808\n", + "rslt: 21441282048 4940890112\n", + "rslt: 21424504832 4940890112\n", + "rslt: 21424504832 4940890112\n", + "rslt: 21424504832 4945084416\n", + "rslt: 21407727616 4945084416\n", + "rslt: 21407727616 4945084416\n", + "rslt: 21407727616 4949278720\n", + "rslt: 21390950400 4949278720\n", + "rslt: 21390950400 4949278720\n", + "rslt: 21390950400 4949278720\n", + "rslt: 21374173184 4953473024\n", + "rslt: 21374173184 4953473024\n", + "rslt: 21374173184 4953473024\n", + "rslt: 21357395968 4957667328\n", + "rslt: 21357395968 4957667328\n", + "rslt: 21357395968 4957667328\n", + "rslt: 21340618752 4961861632\n", + "rslt: 21340618752 4961861632\n", + "rslt: 21340618752 4961861632\n", + "rslt: 21323841536 4966055936\n", + "rslt: 21323841536 4966055936\n", + "rslt: 21323841536 4966055936\n", + "rslt: 21307064320 4970250240\n", + "rslt: 21307064320 4970250240\n", + "rslt: 21307064320 4970250240\n", + "rslt: 21290287104 4974444544\n", + "rslt: 21290287104 4974444544\n", + "rslt: 21290287104 4974444544\n", + "rslt: 21273509888 4978638848\n", + "rslt: 21273509888 4978638848\n", + "rslt: 21273509888 4978638848\n", + "rslt: 21256732672 4978638848\n", + "rslt: 21256732672 4982833152\n", + "rslt: 21256732672 4982833152\n", + "rslt: 21239955456 4982833152\n", + "rslt: 21239955456 4987027456\n", + "rslt: 21239955456 4987027456\n", + "rslt: 21223178240 4987027456\n", + "rslt: 21223178240 4991221760\n", + "rslt: 21223178240 4991221760\n", + "rslt: 21206401024 4991221760\n", + "rslt: 21206401024 4995416064\n", + "rslt: 21206401024 4995416064\n", + "rslt: 21189623808 4995416064\n", + "rslt: 21189623808 4999610368\n", + "rslt: 21189623808 4999610368\n", + "rslt: 21172846592 4999610368\n", + "rslt: 21172846592 5003804672\n", + "rslt: 21172846592 5003804672\n", + "rslt: 21156069376 5003804672\n", + "rslt: 21156069376 5007998976\n", + "rslt: 21156069376 5007998976\n", + "rslt: 21139292160 5007998976\n", + "rslt: 21139292160 5007998976\n", + "rslt: 21139292160 5012193280\n", + "rslt: 21122514944 5012193280\n", + "rslt: 21122514944 5012193280\n", + "rslt: 21122514944 5016387584\n", + "rslt: 21105737728 5016387584\n", + "rslt: 21105737728 5016387584\n", + "rslt: 21105737728 5020581888\n", + "rslt: 21088960512 5020581888\n", + "rslt: 21088960512 5020581888\n", + "rslt: 21088960512 5024776192\n", + "rslt: 21088960512 5024776192\n", + "rslt: 21072183296 5024776192\n", + "rslt: 21072183296 5028970496\n", + "rslt: 21072183296 5028970496\n", + "rslt: 21055406080 5028970496\n", + "rslt: 21055406080 5033164800\n", + "rslt: 21055406080 5033164800\n", + "rslt: 21038628864 5033164800\n", + "rslt: 21038628864 5037359104\n", + "rslt: 21038628864 5037359104\n", + "rslt: 21021851648 5037359104\n", + "rslt: 21021851648 5037359104\n", + "rslt: 21021851648 5041553408\n", + "rslt: 21005074432 5041553408\n", + "rslt: 21005074432 5041553408\n", + "rslt: 21005074432 5045747712\n", + "rslt: 20988297216 5045747712\n", + "rslt: 20988297216 5045747712\n", + "rslt: 20988297216 5049942016\n", + "rslt: 20971520000 5049942016\n", + "rslt: 20971520000 5049942016\n", + "rslt: 20971520000 5054136320\n", + "rslt: 20954742784 5054136320\n", + "rslt: 20954742784 5054136320\n", + "rslt: 20954742784 5058330624\n", + "rslt: 20937965568 5058330624\n", + "rslt: 20937965568 5058330624\n", + "rslt: 20937965568 5062524928\n", + "rslt: 20921188352 5062524928\n", + "rslt: 20921188352 5062524928\n", + "rslt: 20921188352 5066719232\n", + "rslt: 20904411136 5066719232\n", + "rslt: 20904411136 5066719232\n", + "rslt: 20904411136 5066719232\n", + "rslt: 20887633920 5070913536\n", + "rslt: 20887633920 5070913536\n", + "rslt: 20887633920 5070913536\n", + "rslt: 20870856704 5075107840\n", + "rslt: 20870856704 5075107840\n", + "rslt: 20870856704 5075107840\n", + "rslt: 20854079488 5079302144\n", + "rslt: 20854079488 5079302144\n", + "rslt: 20854079488 5079302144\n", + "rslt: 20837302272 5083496448\n", + "rslt: 20837302272 5083496448\n", + "rslt: 20837302272 5083496448\n", + "rslt: 20820525056 5087690752\n", + "rslt: 20820525056 5087690752\n", + "rslt: 20820525056 5087690752\n", + "rslt: 20803747840 5091885056\n", + "rslt: 20803747840 5091885056\n", + "rslt: 20803747840 5091885056\n", + "rslt: 20786970624 5091885056\n", + "rslt: 20786970624 5096079360\n", + "rslt: 20786970624 5096079360\n", + "rslt: 20770193408 5096079360\n", + "rslt: 20770193408 5100273664\n", + "rslt: 20770193408 5100273664\n", + "rslt: 20753416192 5100273664\n", + "rslt: 20753416192 5104467968\n", + "rslt: 20753416192 5104467968\n", + "rslt: 20736638976 5104467968\n", + "rslt: 20736638976 5108662272\n", + "rslt: 20736638976 5108662272\n", + "rslt: 20719861760 5108662272\n", + "rslt: 20719861760 5112856576\n", + "rslt: 20719861760 5112856576\n", + "rslt: 20703084544 5112856576\n", + "rslt: 20703084544 5117050880\n", + "rslt: 20703084544 5117050880\n", + "rslt: 20686307328 5117050880\n", + "rslt: 20686307328 5121245184\n", + "rslt: 20686307328 5121245184\n", + "rslt: 20669530112 5121245184\n", + "rslt: 20669530112 5121245184\n", + "rslt: 20669530112 5125439488\n", + "rslt: 20652752896 5125439488\n", + "rslt: 20652752896 5125439488\n", + "rslt: 20652752896 5129633792\n", + "rslt: 20635975680 5129633792\n", + "rslt: 20635975680 5129633792\n", + "rslt: 20635975680 5133828096\n", + "rslt: 20619198464 5133828096\n", + "rslt: 20619198464 5133828096\n", + "rslt: 20619198464 5138022400\n", + "rslt: 20602421248 5138022400\n", + "rslt: 20602421248 5138022400\n", + "rslt: 20602421248 5142216704\n", + "rslt: 20585644032 5142216704\n", + "rslt: 20585644032 5142216704\n", + "rslt: 20585644032 5146411008\n", + "rslt: 20568866816 5146411008\n", + "rslt: 20568866816 5146411008\n", + "rslt: 20568866816 5150605312\n", + "rslt: 20552089600 5150605312\n", + "rslt: 20552089600 5150605312\n", + "rslt: 20552089600 5150605312\n", + "rslt: 20535312384 5154799616\n", + "rslt: 20535312384 5154799616\n", + "rslt: 20535312384 5154799616\n", + "rslt: 20518535168 5158993920\n", + "rslt: 20518535168 5158993920\n", + "rslt: 20518535168 5158993920\n", + "rslt: 20501757952 5163188224\n", + "rslt: 20501757952 5163188224\n", + "rslt: 20501757952 5163188224\n", + "rslt: 20484980736 5167382528\n", + "rslt: 20484980736 5167382528\n", + "rslt: 20484980736 5167382528\n", + "rslt: 20468203520 5171576832\n", + "rslt: 20468203520 5171576832\n", + "rslt: 20468203520 5171576832\n", + "rslt: 20451426304 5175771136\n", + "rslt: 20451426304 5175771136\n", + "rslt: 20451426304 5175771136\n", + "rslt: 20434649088 5179965440\n", + "rslt: 20434649088 5179965440\n", + "rslt: 20434649088 5179965440\n", + "rslt: 20417871872 5179965440\n", + "rslt: 20417871872 5184159744\n", + "rslt: 20417871872 5184159744\n", + "rslt: 20401094656 5184159744\n", + "rslt: 20401094656 5188354048\n", + "rslt: 20401094656 5188354048\n", + "rslt: 20384317440 5188354048\n", + "rslt: 20384317440 5192548352\n", + "rslt: 20384317440 5192548352\n", + "rslt: 20367540224 5192548352\n", + "rslt: 20367540224 5196742656\n", + "rslt: 20367540224 5196742656\n", + "rslt: 20350763008 5196742656\n", + "rslt: 20350763008 5200936960\n", + "rslt: 20350763008 5200936960\n", + "rslt: 20333985792 5200936960\n", + "rslt: 20333985792 5205131264\n", + "rslt: 20333985792 5205131264\n", + "rslt: 20317208576 5205131264\n", + "rslt: 20317208576 5209325568\n", + "rslt: 20317208576 5209325568\n", + "rslt: 20300431360 5209325568\n", + "rslt: 20300431360 5209325568\n", + "rslt: 20300431360 5213519872\n", + "rslt: 20283654144 5213519872\n", + "rslt: 20283654144 5213519872\n", + "rslt: 20283654144 5217714176\n", + "rslt: 20266876928 5217714176\n", + "rslt: 20266876928 5217714176\n", + "rslt: 20266876928 5221908480\n", + "rslt: 20250099712 5221908480\n", + "rslt: 20250099712 5221908480\n", + "rslt: 20250099712 5226102784\n", + "rslt: 20233322496 5226102784\n", + "rslt: 20233322496 5226102784\n", + "rslt: 20233322496 5230297088\n", + "rslt: 20216545280 5230297088\n", + "rslt: 20216545280 5230297088\n", + "rslt: 20216545280 5234491392\n", + "rslt: 20199768064 5234491392\n", + "rslt: 20199768064 5234491392\n", + "rslt: 20199768064 5238685696\n", + "rslt: 20182990848 5238685696\n", + "rslt: 20182990848 5238685696\n", + "rslt: 20182990848 5238685696\n", + "rslt: 20166213632 5242880000\n", + "rslt: 20166213632 5242880000\n", + "rslt: 20166213632 5242880000\n", + "rslt: 20149436416 5247074304\n", + "rslt: 20149436416 5247074304\n", + "rslt: 20149436416 5247074304\n", + "rslt: 20132659200 5251268608\n", + "rslt: 20132659200 5251268608\n", + "rslt: 20132659200 5251268608\n", + "rslt: 20115881984 5255462912\n", + "rslt: 20115881984 5255462912\n", + "rslt: 20115881984 5255462912\n", + "rslt: 20099104768 5259657216\n", + "rslt: 20099104768 5259657216\n", + "rslt: 20099104768 5259657216\n", + "rslt: 20082327552 5263851520\n", + "rslt: 20082327552 5263851520\n", + "rslt: 20082327552 5263851520\n", + "rslt: 20065550336 5268045824\n", + "rslt: 20065550336 5268045824\n", + "rslt: 20065550336 5268045824\n", + "rslt: 20048773120 5268045824\n", + "rslt: 20048773120 5272240128\n", + "rslt: 20048773120 5272240128\n", + "rslt: 20031995904 5272240128\n", + "rslt: 20031995904 5276434432\n", + "rslt: 20031995904 5276434432\n", + "rslt: 20015218688 5276434432\n", + "rslt: 20015218688 5280628736\n", + "rslt: 20015218688 5280628736\n", + "rslt: 19998441472 5280628736\n", + "rslt: 19998441472 5284823040\n", + "rslt: 19998441472 5284823040\n", + "rslt: 19981664256 5284823040\n", + "rslt: 19981664256 5289017344\n", + "rslt: 19981664256 5289017344\n", + "rslt: 19964887040 5289017344\n", + "rslt: 19964887040 5293211648\n", + "rslt: 19964887040 5293211648\n", + "rslt: 19948109824 5293211648\n", + "rslt: 19948109824 5293211648\n", + "rslt: 19948109824 5297405952\n", + "rslt: 19931332608 5297405952\n", + "rslt: 19931332608 5297405952\n", + "rslt: 19931332608 5301600256\n", + "rslt: 19931332608 5301600256\n", + "rslt: 19914555392 5301600256\n", + "rslt: 19914555392 5305794560\n", + "rslt: 19914555392 5305794560\n", + "rslt: 19897778176 5305794560\n", + "rslt: 19897778176 5309988864\n", + "rslt: 19897778176 5309988864\n", + "rslt: 19881000960 5309988864\n", + "rslt: 19881000960 5314183168\n", + "rslt: 19881000960 5314183168\n", + "rslt: 19864223744 5314183168\n", + "rslt: 19864223744 5318377472\n", + "rslt: 19864223744 5318377472\n", + "rslt: 19847446528 5318377472\n", + "rslt: 19847446528 5322571776\n", + "rslt: 19847446528 5322571776\n", + "rslt: 19830669312 5322571776\n", + "rslt: 19830669312 5322571776\n", + "rslt: 19830669312 5326766080\n", + "rslt: 19813892096 5326766080\n", + "rslt: 19813892096 5326766080\n", + "rslt: 19813892096 5330960384\n", + "rslt: 19797114880 5330960384\n", + "rslt: 19797114880 5330960384\n", + "rslt: 19797114880 5335154688\n", + "rslt: 19780337664 5335154688\n", + "rslt: 19780337664 5335154688\n", + "rslt: 19780337664 5339348992\n", + "rslt: 19763560448 5339348992\n", + "rslt: 19763560448 5339348992\n", + "rslt: 19763560448 5343543296\n", + "rslt: 19746783232 5343543296\n", + "rslt: 19746783232 5343543296\n", + "rslt: 19746783232 5347737600\n", + "rslt: 19730006016 5347737600\n", + "rslt: 19730006016 5347737600\n", + "rslt: 19730006016 5351931904\n", + "rslt: 19713228800 5351931904\n", + "rslt: 19713228800 5351931904\n", + "rslt: 19713228800 5351931904\n", + "rslt: 19696451584 5356126208\n", + "rslt: 19696451584 5356126208\n", + "rslt: 19696451584 5356126208\n", + "rslt: 19679674368 5360320512\n", + "rslt: 19679674368 5360320512\n", + "rslt: 19679674368 5360320512\n", + "rslt: 19662897152 5364514816\n", + "rslt: 19662897152 5364514816\n", + "rslt: 19662897152 5364514816\n", + "rslt: 19646119936 5368709120\n", + "rslt: 19646119936 5368709120\n", + "rslt: 19646119936 5368709120\n", + "rslt: 19629342720 5372903424\n", + "rslt: 19629342720 5372903424\n", + "rslt: 19629342720 5372903424\n", + "rslt: 19612565504 5377097728\n", + "rslt: 19612565504 5377097728\n", + "rslt: 19612565504 5377097728\n", + "rslt: 19595788288 5381292032\n", + "rslt: 19595788288 5381292032\n", + "rslt: 19595788288 5381292032\n", + "rslt: 19579011072 5381292032\n", + "rslt: 19579011072 5385486336\n", + "rslt: 19579011072 5385486336\n", + "rslt: 19562233856 5385486336\n", + "rslt: 19562233856 5389680640\n", + "rslt: 19562233856 5389680640\n", + "rslt: 19545456640 5389680640\n", + "rslt: 19545456640 5393874944\n", + "rslt: 19545456640 5393874944\n", + "rslt: 19528679424 5393874944\n", + "rslt: 19528679424 5398069248\n", + "rslt: 19528679424 5398069248\n", + "rslt: 19511902208 5398069248\n", + "rslt: 19511902208 5402263552\n", + "rslt: 19511902208 5402263552\n", + "rslt: 19495124992 5402263552\n", + "rslt: 19495124992 5406457856\n", + "rslt: 19495124992 5406457856\n", + "rslt: 19478347776 5406457856\n", + "rslt: 19478347776 5410652160\n", + "rslt: 19478347776 5410652160\n", + "rslt: 19461570560 5410652160\n", + "rslt: 19461570560 5410652160\n", + "rslt: 19461570560 5414846464\n", + "rslt: 19444793344 5414846464\n", + "rslt: 19444793344 5414846464\n", + "rslt: 19444793344 5419040768\n", + "rslt: 19428016128 5419040768\n", + "rslt: 19428016128 5419040768\n", + "rslt: 19428016128 5423235072\n", + "rslt: 19411238912 5423235072\n", + "rslt: 19411238912 5423235072\n", + "rslt: 19411238912 5427429376\n", + "rslt: 19394461696 5427429376\n", + "rslt: 19394461696 5427429376\n", + "rslt: 19394461696 5431623680\n", + "rslt: 19377684480 5431623680\n", + "rslt: 19377684480 5431623680\n", + "rslt: 19377684480 5435817984\n", + "rslt: 19360907264 5435817984\n", + "rslt: 19360907264 5435817984\n", + "rslt: 19360907264 5440012288\n", + "rslt: 19344130048 5440012288\n", + "rslt: 19344130048 5440012288\n", + "rslt: 19344130048 5440012288\n", + "rslt: 19327352832 5444206592\n", + "rslt: 19327352832 5444206592\n", + "rslt: 19327352832 5444206592\n", + "rslt: 19310575616 5448400896\n", + "rslt: 19310575616 5448400896\n", + "rslt: 19310575616 5448400896\n", + "rslt: 19293798400 5452595200\n", + "rslt: 19293798400 5452595200\n", + "rslt: 19293798400 5452595200\n", + "rslt: 19277021184 5456789504\n", + "rslt: 19277021184 5456789504\n", + "rslt: 19277021184 5456789504\n", + "rslt: 19260243968 5460983808\n", + "rslt: 19260243968 5460983808\n", + "rslt: 19260243968 5460983808\n", + "rslt: 19243466752 5465178112\n", + "rslt: 19243466752 5465178112\n", + "rslt: 19243466752 5465178112\n", + "rslt: 19226689536 5469372416\n", + "rslt: 19226689536 5469372416\n", + "rslt: 19226689536 5469372416\n", + "rslt: 19209912320 5469372416\n", + "rslt: 19209912320 5473566720\n", + "rslt: 19209912320 5473566720\n", + "rslt: 19193135104 5473566720\n", + "rslt: 19193135104 5477761024\n", + "rslt: 19193135104 5477761024\n", + "rslt: 19176357888 5477761024\n", + "rslt: 19176357888 5481955328\n", + "rslt: 19176357888 5481955328\n", + "rslt: 19159580672 5481955328\n", + "rslt: 19159580672 5486149632\n", + "rslt: 19159580672 5486149632\n", + "rslt: 19142803456 5486149632\n", + "rslt: 19142803456 5490343936\n", + "rslt: 19142803456 5490343936\n", + "rslt: 19126026240 5490343936\n", + "rslt: 19126026240 5494538240\n", + "rslt: 19126026240 5494538240\n", + "rslt: 19109249024 5494538240\n", + "rslt: 19109249024 5494538240\n", + "rslt: 19109249024 5498732544\n", + "rslt: 19092471808 5498732544\n", + "rslt: 19092471808 5498732544\n", + "rslt: 19092471808 5502926848\n", + "rslt: 19075694592 5502926848\n", + "rslt: 19075694592 5502926848\n", + "rslt: 19075694592 5507121152\n", + "rslt: 19058917376 5507121152\n", + "rslt: 19058917376 5507121152\n", + "rslt: 19058917376 5511315456\n", + "rslt: 19042140160 5511315456\n", + "rslt: 19042140160 5511315456\n", + "rslt: 19042140160 5515509760\n", + "rslt: 19025362944 5515509760\n", + "rslt: 19025362944 5515509760\n", + "rslt: 19025362944 5519704064\n", + "rslt: 19008585728 5519704064\n", + "rslt: 19008585728 5519704064\n", + "rslt: 19008585728 5523898368\n", + "rslt: 18991808512 5523898368\n", + "rslt: 18991808512 5523898368\n", + "rslt: 18991808512 5523898368\n", + "rslt: 18975031296 5528092672\n", + "rslt: 18975031296 5528092672\n", + "rslt: 18975031296 5528092672\n", + "rslt: 18958254080 5532286976\n", + "rslt: 18958254080 5532286976\n", + "rslt: 18958254080 5532286976\n", + "rslt: 18941476864 5536481280\n", + "rslt: 18941476864 5536481280\n", + "rslt: 18941476864 5536481280\n", + "rslt: 18924699648 5540675584\n", + "rslt: 18924699648 5540675584\n", + "rslt: 18924699648 5540675584\n", + "rslt: 18907922432 5544869888\n", + "rslt: 18907922432 5544869888\n", + "rslt: 18907922432 5544869888\n", + "rslt: 18891145216 5549064192\n", + "rslt: 18891145216 5549064192\n", + "rslt: 18891145216 5549064192\n", + "rslt: 18874368000 5553258496\n", + "rslt: 18874368000 5553258496\n", + "rslt: 18874368000 5553258496\n", + "rslt: 18857590784 5553258496\n", + "rslt: 18857590784 5557452800\n", + "rslt: 18857590784 5557452800\n", + "rslt: 18840813568 5557452800\n", + "rslt: 18840813568 5561647104\n", + "rslt: 18840813568 5561647104\n", + "rslt: 18824036352 5561647104\n", + "rslt: 18824036352 5565841408\n", + "rslt: 18824036352 5565841408\n", + "rslt: 18807259136 5565841408\n", + "rslt: 18807259136 5570035712\n", + "rslt: 18807259136 5570035712\n", + "rslt: 18790481920 5570035712\n", + "rslt: 18790481920 5574230016\n", + "rslt: 18790481920 5574230016\n", + "rslt: 18773704704 5574230016\n", + "rslt: 18773704704 5578424320\n", + "rslt: 18773704704 5578424320\n", + "rslt: 18756927488 5578424320\n", + "rslt: 18756927488 5582618624\n", + "rslt: 18756927488 5582618624\n", + "rslt: 18756927488 5582618624\n", + "rslt: 18740150272 5582618624\n", + "rslt: 18740150272 5586812928\n", + "rslt: 18740150272 5586812928\n", + "rslt: 18723373056 5586812928\n", + "rslt: 18723373056 5591007232\n", + "rslt: 18723373056 5591007232\n", + "rslt: 18706595840 5591007232\n", + "rslt: 18706595840 5595201536\n", + "rslt: 18706595840 5595201536\n", + "rslt: 18689818624 5595201536\n", + "rslt: 18689818624 5599395840\n", + "rslt: 18689818624 5599395840\n", + "rslt: 18673041408 5599395840\n", + "rslt: 18673041408 5603590144\n", + "rslt: 18673041408 5603590144\n", + "rslt: 18656264192 5603590144\n", + "rslt: 18656264192 5607784448\n", + "rslt: 18656264192 5607784448\n", + "rslt: 18639486976 5607784448\n", + "rslt: 18639486976 5611978752\n", + "rslt: 18639486976 5611978752\n", + "rslt: 18622709760 5611978752\n", + "rslt: 18622709760 5611978752\n", + "rslt: 18622709760 5616173056\n", + "rslt: 18605932544 5616173056\n", + "rslt: 18605932544 5616173056\n", + "rslt: 18605932544 5620367360\n", + "rslt: 18589155328 5620367360\n", + "rslt: 18589155328 5620367360\n", + "rslt: 18589155328 5624561664\n", + "rslt: 18572378112 5624561664\n", + "rslt: 18572378112 5624561664\n", + "rslt: 18572378112 5628755968\n", + "rslt: 18555600896 5628755968\n", + "rslt: 18555600896 5628755968\n", + "rslt: 18555600896 5632950272\n", + "rslt: 18538823680 5632950272\n", + "rslt: 18538823680 5632950272\n", + "rslt: 18538823680 5637144576\n", + "rslt: 18522046464 5637144576\n", + "rslt: 18522046464 5637144576\n", + "rslt: 18522046464 5641338880\n", + "rslt: 18505269248 5641338880\n", + "rslt: 18505269248 5641338880\n", + "rslt: 18505269248 5641338880\n", + "rslt: 18488492032 5645533184\n", + "rslt: 18488492032 5645533184\n", + "rslt: 18488492032 5645533184\n", + "rslt: 18471714816 5649727488\n", + "rslt: 18471714816 5649727488\n", + "rslt: 18471714816 5649727488\n", + "rslt: 18454937600 5653921792\n", + "rslt: 18454937600 5653921792\n", + "rslt: 18454937600 5653921792\n", + "rslt: 18438160384 5658116096\n", + "rslt: 18438160384 5658116096\n", + "rslt: 18438160384 5658116096\n", + "rslt: 18421383168 5662310400\n", + "rslt: 18421383168 5662310400\n", + "rslt: 18421383168 5662310400\n", + "rslt: 18404605952 5666504704\n", + "rslt: 18404605952 5666504704\n", + "rslt: 18404605952 5666504704\n", + "rslt: 18387828736 5670699008\n", + "rslt: 18387828736 5670699008\n", + "rslt: 18387828736 5670699008\n", + "rslt: 18371051520 5670699008\n", + "rslt: 18371051520 5674893312\n", + "rslt: 18371051520 5674893312\n", + "rslt: 18354274304 5674893312\n", + "rslt: 18354274304 5679087616\n", + "rslt: 18354274304 5679087616\n", + "rslt: 18337497088 5679087616\n", + "rslt: 18337497088 5683281920\n", + "rslt: 18337497088 5683281920\n", + "rslt: 18320719872 5683281920\n", + "rslt: 18320719872 5687476224\n", + "rslt: 18320719872 5687476224\n", + "rslt: 18303942656 5687476224\n", + "rslt: 18303942656 5691670528\n", + "rslt: 18303942656 5691670528\n", + "rslt: 18287165440 5691670528\n", + "rslt: 18287165440 5695864832\n", + "rslt: 18287165440 5695864832\n", + "rslt: 18270388224 5695864832\n", + "rslt: 18270388224 5695864832\n", + "rslt: 18270388224 5700059136\n", + "rslt: 18253611008 5700059136\n", + "rslt: 18253611008 5700059136\n", + "rslt: 18253611008 5704253440\n", + "rslt: 18236833792 5704253440\n", + "rslt: 18236833792 5704253440\n", + "rslt: 18236833792 5708447744\n", + "rslt: 18220056576 5708447744\n", + "rslt: 18220056576 5708447744\n", + "rslt: 18220056576 5712642048\n", + "rslt: 18203279360 5712642048\n", + "rslt: 18203279360 5712642048\n", + "rslt: 18203279360 5716836352\n", + "rslt: 18186502144 5716836352\n", + "rslt: 18186502144 5716836352\n", + "rslt: 18186502144 5721030656\n", + "rslt: 18169724928 5721030656\n", + "rslt: 18169724928 5721030656\n", + "rslt: 18169724928 5725224960\n", + "rslt: 18152947712 5725224960\n", + "rslt: 18152947712 5725224960\n", + "rslt: 18152947712 5725224960\n", + "rslt: 18136170496 5729419264\n", + "rslt: 18136170496 5729419264\n", + "rslt: 18136170496 5729419264\n", + "rslt: 18119393280 5733613568\n", + "rslt: 18119393280 5733613568\n", + "rslt: 18119393280 5733613568\n", + "rslt: 18102616064 5737807872\n", + "rslt: 18102616064 5737807872\n", + "rslt: 18102616064 5737807872\n", + "rslt: 18085838848 5742002176\n", + "rslt: 18085838848 5742002176\n", + "rslt: 18085838848 5742002176\n", + "rslt: 18069061632 5746196480\n", + "rslt: 18069061632 5746196480\n", + "rslt: 18069061632 5746196480\n", + "rslt: 18052284416 5750390784\n", + "rslt: 18052284416 5750390784\n", + "rslt: 18052284416 5750390784\n", + "rslt: 18035507200 5754585088\n", + "rslt: 18035507200 5754585088\n", + "rslt: 18035507200 5754585088\n", + "rslt: 18018729984 5754585088\n", + "rslt: 18018729984 5758779392\n", + "rslt: 18018729984 5758779392\n", + "rslt: 18001952768 5758779392\n", + "rslt: 18001952768 5762973696\n", + "rslt: 18001952768 5762973696\n", + "rslt: 17985175552 5762973696\n", + "rslt: 17985175552 5767168000\n", + "rslt: 17985175552 5767168000\n", + "rslt: 17968398336 5767168000\n", + "rslt: 17968398336 5771362304\n", + "rslt: 17968398336 5771362304\n", + "rslt: 17951621120 5771362304\n", + "rslt: 17951621120 5775556608\n", + "rslt: 17951621120 5775556608\n", + "rslt: 17934843904 5775556608\n", + "rslt: 17934843904 5779750912\n", + "rslt: 17934843904 5779750912\n", + "rslt: 17918066688 5779750912\n", + "rslt: 17918066688 5783945216\n", + "rslt: 17918066688 5783945216\n", + "rslt: 17901289472 5783945216\n", + "rslt: 17901289472 5783945216\n", + "rslt: 17901289472 5788139520\n", + "rslt: 17884512256 5788139520\n", + "rslt: 17884512256 5788139520\n", + "rslt: 17884512256 5792333824\n", + "rslt: 17867735040 5792333824\n", + "rslt: 17867735040 5792333824\n", + "rslt: 17867735040 5796528128\n", + "rslt: 17850957824 5796528128\n", + "rslt: 17850957824 5796528128\n", + "rslt: 17850957824 5800722432\n", + "rslt: 17834180608 5800722432\n", + "rslt: 17834180608 5800722432\n", + "rslt: 17834180608 5804916736\n", + "rslt: 17817403392 5804916736\n", + "rslt: 17817403392 5804916736\n", + "rslt: 17817403392 5809111040\n", + "rslt: 17800626176 5809111040\n", + "rslt: 17800626176 5809111040\n", + "rslt: 17800626176 5813305344\n", + "rslt: 17783848960 5813305344\n", + "rslt: 17783848960 5813305344\n", + "rslt: 17783848960 5813305344\n", + "rslt: 17767071744 5817499648\n", + "rslt: 17767071744 5817499648\n", + "rslt: 17767071744 5817499648\n", + "rslt: 17750294528 5821693952\n", + "rslt: 17750294528 5821693952\n", + "rslt: 17750294528 5821693952\n", + "rslt: 17733517312 5825888256\n", + "rslt: 17733517312 5825888256\n", + "rslt: 17733517312 5825888256\n", + "rslt: 17716740096 5830082560\n", + "rslt: 17716740096 5830082560\n", + "rslt: 17716740096 5830082560\n", + "rslt: 17699962880 5834276864\n", + "rslt: 17699962880 5834276864\n", + "rslt: 17699962880 5834276864\n", + "rslt: 17683185664 5838471168\n", + "rslt: 17683185664 5838471168\n", + "rslt: 17683185664 5838471168\n", + "rslt: 17666408448 5842665472\n", + "rslt: 17666408448 5842665472\n", + "rslt: 17666408448 5842665472\n", + "rslt: 17649631232 5842665472\n", + "rslt: 17649631232 5846859776\n", + "rslt: 17649631232 5846859776\n", + "rslt: 17632854016 5846859776\n", + "rslt: 17632854016 5851054080\n", + "rslt: 17632854016 5851054080\n", + "rslt: 17616076800 5851054080\n", + "rslt: 17616076800 5855248384\n", + "rslt: 17616076800 5855248384\n", + "rslt: 17599299584 5855248384\n", + "rslt: 17599299584 5859442688\n", + "rslt: 17599299584 5859442688\n", + "rslt: 17599299584 5859442688\n", + "rslt: 17582522368 5863636992\n", + "rslt: 17582522368 5863636992\n", + "rslt: 17582522368 5863636992\n", + "rslt: 17565745152 5867831296\n", + "rslt: 17565745152 5867831296\n", + "rslt: 17565745152 5867831296\n", + "rslt: 17548967936 5872025600\n", + "rslt: 17548967936 5872025600\n", + "rslt: 17548967936 5872025600\n", + "rslt: 17532190720 5872025600\n", + "rslt: 17532190720 5876219904\n", + "rslt: 17532190720 5876219904\n", + "rslt: 17515413504 5876219904\n", + "rslt: 17515413504 5880414208\n", + "rslt: 17515413504 5880414208\n", + "rslt: 17498636288 5880414208\n", + "rslt: 17498636288 5884608512\n", + "rslt: 17498636288 5884608512\n", + "rslt: 17481859072 5884608512\n", + "rslt: 17481859072 5888802816\n", + "rslt: 17481859072 5888802816\n", + "rslt: 17465081856 5888802816\n", + "rslt: 17465081856 5892997120\n", + "rslt: 17465081856 5892997120\n", + "rslt: 17448304640 5892997120\n", + "rslt: 17448304640 5897191424\n", + "rslt: 17448304640 5897191424\n", + "rslt: 17431527424 5897191424\n", + "rslt: 17431527424 5897191424\n", + "rslt: 17431527424 5901385728\n", + "rslt: 17414750208 5901385728\n", + "rslt: 17414750208 5901385728\n", + "rslt: 17414750208 5905580032\n", + "rslt: 17397972992 5905580032\n", + "rslt: 17397972992 5905580032\n", + "rslt: 17397972992 5909774336\n", + "rslt: 17381195776 5909774336\n", + "rslt: 17381195776 5909774336\n", + "rslt: 17381195776 5913968640\n", + "rslt: 17364418560 5913968640\n", + "rslt: 17364418560 5913968640\n", + "rslt: 17364418560 5918162944\n", + "rslt: 17347641344 5918162944\n", + "rslt: 17347641344 5918162944\n", + "rslt: 17347641344 5922357248\n", + "rslt: 17330864128 5922357248\n", + "rslt: 17330864128 5922357248\n", + "rslt: 17330864128 5926551552\n", + "rslt: 17314086912 5926551552\n", + "rslt: 17314086912 5926551552\n", + "rslt: 17314086912 5926551552\n", + "rslt: 17297309696 5930745856\n", + "rslt: 17297309696 5930745856\n", + "rslt: 17297309696 5930745856\n", + "rslt: 17280532480 5934940160\n", + "rslt: 17280532480 5934940160\n", + "rslt: 17280532480 5934940160\n", + "rslt: 17263755264 5939134464\n", + "rslt: 17263755264 5939134464\n", + "rslt: 17263755264 5939134464\n", + "rslt: 17246978048 5943328768\n", + "rslt: 17246978048 5943328768\n", + "rslt: 17246978048 5943328768\n", + "rslt: 17230200832 5947523072\n", + "rslt: 17230200832 5947523072\n", + "rslt: 17230200832 5947523072\n", + "rslt: 17213423616 5951717376\n", + "rslt: 17213423616 5951717376\n", + "rslt: 17213423616 5951717376\n", + "rslt: 17196646400 5955911680\n", + "rslt: 17196646400 5955911680\n", + "rslt: 17196646400 5955911680\n", + "rslt: 17179869184 5955911680\n", + "rslt: 17179869184 5960105984\n", + "rslt: 17179869184 5960105984\n", + "rslt: 17163091968 5960105984\n", + "rslt: 17163091968 5964300288\n", + "rslt: 17163091968 5964300288\n", + "rslt: 17146314752 5964300288\n", + "rslt: 17146314752 5968494592\n", + "rslt: 17146314752 5968494592\n", + "rslt: 17129537536 5968494592\n", + "rslt: 17129537536 5972688896\n", + "rslt: 17129537536 5972688896\n", + "rslt: 17112760320 5972688896\n", + "rslt: 17112760320 5976883200\n", + "rslt: 17112760320 5976883200\n", + "rslt: 17095983104 5976883200\n", + "rslt: 17095983104 5981077504\n", + "rslt: 17095983104 5981077504\n", + "rslt: 17079205888 5981077504\n", + "rslt: 17079205888 5985271808\n", + "rslt: 17079205888 5985271808\n", + "rslt: 17062428672 5985271808\n", + "rslt: 17062428672 5985271808\n", + "rslt: 17062428672 5989466112\n", + "rslt: 17045651456 5989466112\n", + "rslt: 17045651456 5989466112\n", + "rslt: 17045651456 5993660416\n", + "rslt: 17028874240 5993660416\n", + "rslt: 17028874240 5993660416\n", + "rslt: 17028874240 5997854720\n", + "rslt: 17012097024 5997854720\n", + "rslt: 17012097024 5997854720\n", + "rslt: 17012097024 6002049024\n", + "rslt: 16995319808 6002049024\n", + "rslt: 16995319808 6002049024\n", + "rslt: 16995319808 6006243328\n", + "rslt: 16978542592 6006243328\n", + "rslt: 16978542592 6006243328\n", + "rslt: 16978542592 6010437632\n", + "rslt: 16961765376 6010437632\n", + "rslt: 16961765376 6010437632\n", + "rslt: 16961765376 6014631936\n", + "rslt: 16944988160 6014631936\n", + "rslt: 16944988160 6014631936\n", + "rslt: 16944988160 6014631936\n", + "rslt: 16928210944 6018826240\n", + "rslt: 16928210944 6018826240\n", + "rslt: 16928210944 6018826240\n", + "rslt: 16911433728 6023020544\n", + "rslt: 16911433728 6023020544\n", + "rslt: 16911433728 6023020544\n", + "rslt: 16894656512 6027214848\n", + "rslt: 16894656512 6027214848\n", + "rslt: 16894656512 6027214848\n", + "rslt: 16877879296 6031409152\n", + "rslt: 16877879296 6031409152\n", + "rslt: 16877879296 6031409152\n", + "rslt: 16861102080 6035603456\n", + "rslt: 16861102080 6035603456\n", + "rslt: 16861102080 6035603456\n", + "rslt: 16844324864 6039797760\n", + "rslt: 16844324864 6039797760\n", + "rslt: 16844324864 6039797760\n", + "rslt: 16827547648 6043992064\n", + "rslt: 16827547648 6043992064\n", + "rslt: 16827547648 6043992064\n", + "rslt: 16810770432 6043992064\n", + "rslt: 16810770432 6048186368\n", + "rslt: 16810770432 6048186368\n", + "rslt: 16793993216 6048186368\n", + "rslt: 16793993216 6052380672\n", + "rslt: 16793993216 6052380672\n", + "rslt: 16777216000 6052380672\n", + "rslt: 16777216000 6056574976\n", + "rslt: 16777216000 6056574976\n", + "rslt: 16760438784 6056574976\n", + "rslt: 16760438784 6060769280\n", + "rslt: 16760438784 6060769280\n", + "rslt: 16743661568 6060769280\n", + "rslt: 16743661568 6064963584\n", + "rslt: 16743661568 6064963584\n", + "rslt: 16726884352 6064963584\n", + "rslt: 16726884352 6069157888\n", + "rslt: 16726884352 6069157888\n", + "rslt: 16710107136 6069157888\n", + "rslt: 16710107136 6073352192\n", + "rslt: 16710107136 6073352192\n", + "rslt: 16693329920 6073352192\n", + "rslt: 16693329920 6073352192\n", + "rslt: 16693329920 6077546496\n", + "rslt: 16676552704 6077546496\n", + "rslt: 16676552704 6077546496\n", + "rslt: 16676552704 6081740800\n", + "rslt: 16659775488 6081740800\n", + "rslt: 16659775488 6081740800\n", + "rslt: 16659775488 6085935104\n", + "rslt: 16642998272 6085935104\n", + "rslt: 16642998272 6085935104\n", + "rslt: 16642998272 6090129408\n", + "rslt: 16626221056 6090129408\n", + "rslt: 16626221056 6090129408\n", + "rslt: 16626221056 6094323712\n", + "rslt: 16609443840 6094323712\n", + "rslt: 16609443840 6094323712\n", + "rslt: 16609443840 6098518016\n", + "rslt: 16592666624 6098518016\n", + "rslt: 16592666624 6098518016\n", + "rslt: 16592666624 6098518016\n", + "rslt: 16575889408 6102712320\n", + "rslt: 16575889408 6102712320\n", + "rslt: 16575889408 6102712320\n", + "rslt: 16559112192 6106906624\n", + "rslt: 16559112192 6106906624\n", + "rslt: 16559112192 6106906624\n", + "rslt: 16542334976 6111100928\n", + "rslt: 16542334976 6111100928\n", + "rslt: 16542334976 6111100928\n", + "rslt: 16525557760 6115295232\n", + "rslt: 16525557760 6115295232\n", + "rslt: 16525557760 6115295232\n", + "rslt: 16508780544 6119489536\n", + "rslt: 16508780544 6119489536\n", + "rslt: 16508780544 6119489536\n", + "rslt: 16492003328 6123683840\n", + "rslt: 16492003328 6123683840\n", + "rslt: 16492003328 6123683840\n", + "rslt: 16475226112 6127878144\n", + "rslt: 16475226112 6127878144\n", + "rslt: 16475226112 6127878144\n", + "rslt: 16458448896 6127878144\n", + "rslt: 16458448896 6132072448\n", + "rslt: 16458448896 6132072448\n", + "rslt: 16441671680 6132072448\n", + "rslt: 16441671680 6136266752\n", + "rslt: 16441671680 6136266752\n", + "rslt: 16441671680 6136266752\n", + "rslt: 16424894464 6140461056\n", + "rslt: 16424894464 6140461056\n", + "rslt: 16424894464 6140461056\n", + "rslt: 16408117248 6144655360\n", + "rslt: 16408117248 6144655360\n", + "rslt: 16408117248 6144655360\n", + "rslt: 16391340032 6148849664\n", + "rslt: 16391340032 6148849664\n", + "rslt: 16391340032 6148849664\n", + "rslt: 16374562816 6153043968\n", + "rslt: 16374562816 6153043968\n", + "rslt: 16374562816 6153043968\n", + "rslt: 16357785600 6157238272\n", + "rslt: 16357785600 6157238272\n", + "rslt: 16357785600 6157238272\n", + "rslt: 16341008384 6157238272\n", + "rslt: 16341008384 6161432576\n", + "rslt: 16341008384 6161432576\n", + "rslt: 16324231168 6161432576\n", + "rslt: 16324231168 6165626880\n", + "rslt: 16324231168 6165626880\n", + "rslt: 16307453952 6165626880\n", + "rslt: 16307453952 6169821184\n", + "rslt: 16307453952 6169821184\n", + "rslt: 16290676736 6169821184\n", + "rslt: 16290676736 6174015488\n", + "rslt: 16290676736 6174015488\n", + "rslt: 16273899520 6174015488\n", + "rslt: 16273899520 6178209792\n", + "rslt: 16273899520 6178209792\n", + "rslt: 16257122304 6178209792\n", + "rslt: 16257122304 6182404096\n", + "rslt: 16257122304 6182404096\n", + "rslt: 16240345088 6182404096\n", + "rslt: 16240345088 6186598400\n", + "rslt: 16240345088 6186598400\n", + "rslt: 16223567872 6186598400\n", + "rslt: 16223567872 6186598400\n", + "rslt: 16223567872 6190792704\n", + "rslt: 16206790656 6190792704\n", + "rslt: 16206790656 6190792704\n", + "rslt: 16206790656 6194987008\n", + "rslt: 16190013440 6194987008\n", + "rslt: 16190013440 6194987008\n", + "rslt: 16190013440 6199181312\n", + "rslt: 16173236224 6199181312\n", + "rslt: 16173236224 6199181312\n", + "rslt: 16173236224 6203375616\n", + "rslt: 16156459008 6203375616\n", + "rslt: 16156459008 6203375616\n", + "rslt: 16156459008 6207569920\n", + "rslt: 16139681792 6207569920\n", + "rslt: 16139681792 6207569920\n", + "rslt: 16139681792 6211764224\n", + "rslt: 16122904576 6211764224\n", + "rslt: 16122904576 6211764224\n", + "rslt: 16122904576 6215958528\n", + "rslt: 16106127360 6215958528\n", + "rslt: 16106127360 6215958528\n", + "rslt: 16106127360 6215958528\n", + "rslt: 16089350144 6220152832\n", + "rslt: 16089350144 6220152832\n", + "rslt: 16089350144 6220152832\n", + "rslt: 16072572928 6224347136\n", + "rslt: 16072572928 6224347136\n", + "rslt: 16072572928 6224347136\n", + "rslt: 16055795712 6228541440\n", + "rslt: 16055795712 6228541440\n", + "rslt: 16055795712 6228541440\n", + "rslt: 16039018496 6232735744\n", + "rslt: 16039018496 6232735744\n", + "rslt: 16039018496 6232735744\n", + "rslt: 16022241280 6236930048\n", + "rslt: 16022241280 6236930048\n", + "rslt: 16022241280 6236930048\n", + "rslt: 16005464064 6241124352\n", + "rslt: 16005464064 6241124352\n", + "rslt: 16005464064 6241124352\n", + "rslt: 15988686848 6245318656\n", + "rslt: 15988686848 6245318656\n", + "rslt: 15988686848 6245318656\n", + "rslt: 15971909632 6245318656\n", + "rslt: 15971909632 6249512960\n", + "rslt: 15971909632 6249512960\n", + "rslt: 15955132416 6249512960\n", + "rslt: 15955132416 6253707264\n", + "rslt: 15955132416 6253707264\n", + "rslt: 15938355200 6253707264\n", + "rslt: 15938355200 6257901568\n", + "rslt: 15938355200 6257901568\n", + "rslt: 15921577984 6257901568\n", + "rslt: 15921577984 6262095872\n", + "rslt: 15921577984 6262095872\n", + "rslt: 15904800768 6262095872\n", + "rslt: 15904800768 6266290176\n", + "rslt: 15904800768 6266290176\n", + "rslt: 15888023552 6266290176\n", + "rslt: 15888023552 6270484480\n", + "rslt: 15888023552 6270484480\n", + "rslt: 15871246336 6270484480\n", + "rslt: 15871246336 6274678784\n", + "rslt: 15871246336 6274678784\n", + "rslt: 15854469120 6274678784\n", + "rslt: 15854469120 6274678784\n", + "rslt: 15854469120 6278873088\n", + "rslt: 15837691904 6278873088\n", + "rslt: 15837691904 6278873088\n", + "rslt: 15837691904 6283067392\n", + "rslt: 15820914688 6283067392\n", + "rslt: 15820914688 6283067392\n", + "rslt: 15820914688 6287261696\n", + "rslt: 15804137472 6287261696\n", + "rslt: 15804137472 6287261696\n", + "rslt: 15804137472 6291456000\n", + "rslt: 15787360256 6291456000\n", + "rslt: 15787360256 6291456000\n", + "rslt: 15787360256 6295650304\n", + "rslt: 15770583040 6295650304\n", + "rslt: 15770583040 6295650304\n", + "rslt: 15770583040 6299844608\n", + "rslt: 15753805824 6299844608\n", + "rslt: 15753805824 6299844608\n", + "rslt: 15753805824 6304038912\n", + "rslt: 15737028608 6304038912\n", + "rslt: 15737028608 6304038912\n", + "rslt: 15737028608 6304038912\n", + "rslt: 15720251392 6308233216\n", + "rslt: 15720251392 6308233216\n", + "rslt: 15720251392 6308233216\n", + "rslt: 15703474176 6312427520\n", + "rslt: 15703474176 6312427520\n", + "rslt: 15703474176 6312427520\n", + "rslt: 15686696960 6316621824\n", + "rslt: 15686696960 6316621824\n", + "rslt: 15686696960 6316621824\n", + "rslt: 15669919744 6320816128\n", + "rslt: 15669919744 6320816128\n", + "rslt: 15669919744 6320816128\n", + "rslt: 15653142528 6325010432\n", + "rslt: 15653142528 6325010432\n", + "rslt: 15653142528 6325010432\n", + "rslt: 15636365312 6329204736\n", + "rslt: 15636365312 6329204736\n", + "rslt: 15636365312 6329204736\n", + "rslt: 15619588096 6329204736\n", + "rslt: 15619588096 6333399040\n", + "rslt: 15619588096 6333399040\n", + "rslt: 15602810880 6333399040\n", + "rslt: 15602810880 6337593344\n", + "rslt: 15602810880 6337593344\n", + "rslt: 15586033664 6337593344\n", + "rslt: 15586033664 6341787648\n", + "rslt: 15586033664 6341787648\n", + "rslt: 15569256448 6341787648\n", + "rslt: 15569256448 6345981952\n", + "rslt: 15569256448 6345981952\n", + "rslt: 15552479232 6345981952\n", + "rslt: 15552479232 6350176256\n", + "rslt: 15552479232 6350176256\n", + "rslt: 15535702016 6350176256\n", + "rslt: 15535702016 6354370560\n", + "rslt: 15535702016 6354370560\n", + "rslt: 15518924800 6354370560\n", + "rslt: 15518924800 6358564864\n", + "rslt: 15518924800 6358564864\n", + "rslt: 15502147584 6358564864\n", + "rslt: 15502147584 6358564864\n", + "rslt: 15502147584 6362759168\n", + "rslt: 15485370368 6362759168\n", + "rslt: 15485370368 6362759168\n", + "rslt: 15485370368 6366953472\n", + "rslt: 15468593152 6366953472\n", + "rslt: 15468593152 6366953472\n", + "rslt: 15468593152 6371147776\n", + "rslt: 15451815936 6371147776\n", + "rslt: 15451815936 6371147776\n", + "rslt: 15451815936 6375342080\n", + "rslt: 15435038720 6375342080\n", + "rslt: 15435038720 6375342080\n", + "rslt: 15435038720 6379536384\n", + "rslt: 15418261504 6379536384\n", + "rslt: 15418261504 6379536384\n", + "rslt: 15418261504 6383730688\n", + "rslt: 15401484288 6383730688\n", + "rslt: 15401484288 6383730688\n", + "rslt: 15401484288 6387924992\n", + "rslt: 15384707072 6387924992\n", + "rslt: 15384707072 6387924992\n", + "rslt: 15384707072 6387924992\n", + "rslt: 15367929856 6392119296\n", + "rslt: 15367929856 6392119296\n", + "rslt: 15367929856 6392119296\n", + "rslt: 15351152640 6396313600\n", + "rslt: 15351152640 6396313600\n", + "rslt: 15351152640 6396313600\n", + "rslt: 15334375424 6400507904\n", + "rslt: 15334375424 6400507904\n", + "rslt: 15334375424 6400507904\n", + "rslt: 15317598208 6404702208\n", + "rslt: 15317598208 6404702208\n", + "rslt: 15317598208 6404702208\n", + "rslt: 15300820992 6408896512\n", + "rslt: 15300820992 6408896512\n", + "rslt: 15300820992 6408896512\n", + "rslt: 15284043776 6413090816\n", + "rslt: 15284043776 6413090816\n", + "rslt: 15284043776 6413090816\n", + "rslt: 15267266560 6417285120\n", + "rslt: 15267266560 6417285120\n", + "rslt: 15267266560 6417285120\n", + "rslt: 15267266560 6417285120\n", + "rslt: 15250489344 6421479424\n", + "rslt: 15250489344 6421479424\n", + "rslt: 15250489344 6421479424\n", + "rslt: 15233712128 6425673728\n", + "rslt: 15233712128 6425673728\n", + "rslt: 15233712128 6425673728\n", + "rslt: 15216934912 6429868032\n", + "rslt: 15216934912 6429868032\n", + "rslt: 15216934912 6429868032\n", + "rslt: 15200157696 6434062336\n", + "rslt: 15200157696 6434062336\n", + "rslt: 15200157696 6434062336\n", + "rslt: 15183380480 6438256640\n", + "rslt: 15183380480 6438256640\n", + "rslt: 15183380480 6438256640\n", + "rslt: 15166603264 6442450944\n", + "rslt: 15166603264 6442450944\n", + "rslt: 15166603264 6442450944\n", + "rslt: 15149826048 6446645248\n", + "rslt: 15149826048 6446645248\n", + "rslt: 15149826048 6446645248\n", + "rslt: 15133048832 6446645248\n", + "rslt: 15133048832 6450839552\n", + "rslt: 15133048832 6450839552\n", + "rslt: 15116271616 6450839552\n", + "rslt: 15116271616 6455033856\n", + "rslt: 15116271616 6455033856\n", + "rslt: 15099494400 6455033856\n", + "rslt: 15099494400 6459228160\n", + "rslt: 15099494400 6459228160\n", + "rslt: 15082717184 6459228160\n", + "rslt: 15082717184 6463422464\n", + "rslt: 15082717184 6463422464\n", + "rslt: 15065939968 6463422464\n", + "rslt: 15065939968 6467616768\n", + "rslt: 15065939968 6467616768\n", + "rslt: 15049162752 6467616768\n", + "rslt: 15049162752 6471811072\n", + "rslt: 15049162752 6471811072\n", + "rslt: 15032385536 6471811072\n", + "rslt: 15032385536 6476005376\n", + "rslt: 15032385536 6476005376\n", + "rslt: 15015608320 6476005376\n", + "rslt: 15015608320 6476005376\n", + "rslt: 15015608320 6480199680\n", + "rslt: 14998831104 6480199680\n", + "rslt: 14998831104 6480199680\n", + "rslt: 14998831104 6484393984\n", + "rslt: 14982053888 6484393984\n", + "rslt: 14982053888 6484393984\n", + "rslt: 14982053888 6488588288\n", + "rslt: 14965276672 6488588288\n", + "rslt: 14965276672 6488588288\n", + "rslt: 14965276672 6492782592\n", + "rslt: 14948499456 6492782592\n", + "rslt: 14948499456 6492782592\n", + "rslt: 14948499456 6496976896\n", + "rslt: 14931722240 6496976896\n", + "rslt: 14931722240 6496976896\n", + "rslt: 14931722240 6501171200\n", + "rslt: 14914945024 6501171200\n", + "rslt: 14914945024 6501171200\n", + "rslt: 14914945024 6505365504\n", + "rslt: 14898167808 6505365504\n", + "rslt: 14898167808 6505365504\n", + "rslt: 14898167808 6505365504\n", + "rslt: 14881390592 6509559808\n", + "rslt: 14881390592 6509559808\n", + "rslt: 14881390592 6509559808\n", + "rslt: 14864613376 6513754112\n", + "rslt: 14864613376 6513754112\n", + "rslt: 14864613376 6513754112\n", + "rslt: 14847836160 6517948416\n", + "rslt: 14847836160 6517948416\n", + "rslt: 14847836160 6517948416\n", + "rslt: 14831058944 6522142720\n", + "rslt: 14831058944 6522142720\n", + "rslt: 14831058944 6522142720\n", + "rslt: 14814281728 6526337024\n", + "rslt: 14814281728 6526337024\n", + "rslt: 14814281728 6526337024\n", + "rslt: 14797504512 6530531328\n", + "rslt: 14797504512 6530531328\n", + "rslt: 14797504512 6530531328\n", + "rslt: 14780727296 6530531328\n", + "rslt: 14780727296 6534725632\n", + "rslt: 14780727296 6534725632\n", + "rslt: 14763950080 6534725632\n", + "rslt: 14763950080 6538919936\n", + "rslt: 14763950080 6538919936\n", + "rslt: 14747172864 6538919936\n", + "rslt: 14747172864 6543114240\n", + "rslt: 14747172864 6543114240\n", + "rslt: 14730395648 6543114240\n", + "rslt: 14730395648 6547308544\n", + "rslt: 14730395648 6547308544\n", + "rslt: 14713618432 6547308544\n", + "rslt: 14713618432 6551502848\n", + "rslt: 14713618432 6551502848\n", + "rslt: 14696841216 6551502848\n", + "rslt: 14696841216 6555697152\n", + "rslt: 14696841216 6555697152\n", + "rslt: 14680064000 6555697152\n", + "rslt: 14680064000 6559891456\n", + "rslt: 14680064000 6559891456\n", + "rslt: 14663286784 6559891456\n", + "rslt: 14663286784 6559891456\n", + "rslt: 14663286784 6564085760\n", + "rslt: 14646509568 6564085760\n", + "rslt: 14646509568 6564085760\n", + "rslt: 14646509568 6568280064\n", + "rslt: 14629732352 6568280064\n", + "rslt: 14629732352 6568280064\n", + "rslt: 14629732352 6572474368\n", + "rslt: 14612955136 6572474368\n", + "rslt: 14612955136 6572474368\n", + "rslt: 14612955136 6576668672\n", + "rslt: 14596177920 6576668672\n", + "rslt: 14596177920 6576668672\n", + "rslt: 14596177920 6580862976\n", + "rslt: 14579400704 6580862976\n", + "rslt: 14579400704 6580862976\n", + "rslt: 14579400704 6585057280\n", + "rslt: 14562623488 6585057280\n", + "rslt: 14562623488 6585057280\n", + "rslt: 14562623488 6589251584\n", + "rslt: 14545846272 6589251584\n", + "rslt: 14545846272 6589251584\n", + "rslt: 14545846272 6589251584\n", + "rslt: 14529069056 6593445888\n", + "rslt: 14529069056 6593445888\n", + "rslt: 14529069056 6593445888\n", + "rslt: 14512291840 6597640192\n", + "rslt: 14512291840 6597640192\n", + "rslt: 14512291840 6597640192\n", + "rslt: 14495514624 6601834496\n", + "rslt: 14495514624 6601834496\n", + "rslt: 14495514624 6601834496\n", + "rslt: 14478737408 6606028800\n", + "rslt: 14478737408 6606028800\n", + "rslt: 14478737408 6606028800\n", + "rslt: 14461960192 6610223104\n", + "rslt: 14461960192 6610223104\n", + "rslt: 14461960192 6610223104\n", + "rslt: 14445182976 6614417408\n", + "rslt: 14445182976 6614417408\n", + "rslt: 14445182976 6614417408\n", + "rslt: 14428405760 6618611712\n", + "rslt: 14428405760 6618611712\n", + "rslt: 14428405760 6618611712\n", + "rslt: 14411628544 6618611712\n", + "rslt: 14411628544 6622806016\n", + "rslt: 14411628544 6622806016\n", + "rslt: 14394851328 6622806016\n", + "rslt: 14394851328 6627000320\n", + "rslt: 14394851328 6627000320\n", + "rslt: 14378074112 6627000320\n", + "rslt: 14378074112 6631194624\n", + "rslt: 14378074112 6631194624\n", + "rslt: 14361296896 6631194624\n", + "rslt: 14361296896 6635388928\n", + "rslt: 14361296896 6635388928\n", + "rslt: 14344519680 6635388928\n", + "rslt: 14344519680 6639583232\n", + "rslt: 14344519680 6639583232\n", + "rslt: 14327742464 6639583232\n", + "rslt: 14327742464 6643777536\n", + "rslt: 14327742464 6643777536\n", + "rslt: 14310965248 6643777536\n", + "rslt: 14310965248 6647971840\n", + "rslt: 14310965248 6647971840\n", + "rslt: 14294188032 6647971840\n", + "rslt: 14294188032 6647971840\n", + "rslt: 14294188032 6652166144\n", + "rslt: 14277410816 6652166144\n", + "rslt: 14277410816 6652166144\n", + "rslt: 14277410816 6656360448\n", + "rslt: 14260633600 6656360448\n", + "rslt: 14260633600 6656360448\n", + "rslt: 14260633600 6660554752\n", + "rslt: 14243856384 6660554752\n", + "rslt: 14243856384 6660554752\n", + "rslt: 14243856384 6664749056\n", + "rslt: 14227079168 6664749056\n", + "rslt: 14227079168 6664749056\n", + "rslt: 14227079168 6668943360\n", + "rslt: 14210301952 6668943360\n", + "rslt: 14210301952 6668943360\n", + "rslt: 14210301952 6673137664\n", + "rslt: 14193524736 6673137664\n", + "rslt: 14193524736 6673137664\n", + "rslt: 14193524736 6677331968\n", + "rslt: 14176747520 6677331968\n", + "rslt: 14176747520 6677331968\n", + "rslt: 14176747520 6677331968\n", + "rslt: 14159970304 6681526272\n", + "rslt: 14159970304 6681526272\n", + "rslt: 14159970304 6681526272\n", + "rslt: 14143193088 6685720576\n", + "rslt: 14143193088 6685720576\n", + "rslt: 14143193088 6685720576\n", + "rslt: 14126415872 6689914880\n", + "rslt: 14126415872 6689914880\n", + "rslt: 14126415872 6689914880\n", + "rslt: 14109638656 6694109184\n", + "rslt: 14109638656 6694109184\n", + "rslt: 14109638656 6694109184\n", + "rslt: 14109638656 6698303488\n", + "rslt: 14092861440 6698303488\n", + "rslt: 14092861440 6698303488\n", + "rslt: 14092861440 6702497792\n", + "rslt: 14076084224 6702497792\n", + "rslt: 14076084224 6702497792\n", + "rslt: 14076084224 6706692096\n", + "rslt: 14059307008 6706692096\n", + "rslt: 14059307008 6706692096\n", + "rslt: 14059307008 6706692096\n", + "rslt: 14042529792 6710886400\n", + "rslt: 14042529792 6710886400\n", + "rslt: 14042529792 6710886400\n", + "rslt: 14025752576 6715080704\n", + "rslt: 14025752576 6715080704\n", + "rslt: 14025752576 6715080704\n", + "rslt: 14008975360 6719275008\n", + "rslt: 14008975360 6719275008\n", + "rslt: 14008975360 6719275008\n", + "rslt: 13992198144 6723469312\n", + "rslt: 13992198144 6723469312\n", + "rslt: 13992198144 6723469312\n", + "rslt: 13975420928 6727663616\n", + "rslt: 13975420928 6727663616\n", + "rslt: 13975420928 6727663616\n", + "rslt: 13958643712 6731857920\n", + "rslt: 13958643712 6731857920\n", + "rslt: 13958643712 6731857920\n", + "rslt: 13941866496 6731857920\n", + "rslt: 13941866496 6736052224\n", + "rslt: 13941866496 6736052224\n", + "rslt: 13925089280 6736052224\n", + "rslt: 13925089280 6740246528\n", + "rslt: 13925089280 6740246528\n", + "rslt: 13908312064 6740246528\n", + "rslt: 13908312064 6744440832\n", + "rslt: 13908312064 6744440832\n", + "rslt: 13891534848 6744440832\n", + "rslt: 13891534848 6748635136\n", + "rslt: 13891534848 6748635136\n", + "rslt: 13874757632 6748635136\n", + "rslt: 13874757632 6752829440\n", + "rslt: 13874757632 6752829440\n", + "rslt: 13857980416 6752829440\n", + "rslt: 13857980416 6757023744\n", + "rslt: 13857980416 6757023744\n", + "rslt: 13841203200 6757023744\n", + "rslt: 13841203200 6761218048\n", + "rslt: 13841203200 6761218048\n", + "rslt: 13824425984 6761218048\n", + "rslt: 13824425984 6761218048\n", + "rslt: 13824425984 6765412352\n", + "rslt: 13807648768 6765412352\n", + "rslt: 13807648768 6765412352\n", + "rslt: 13807648768 6769606656\n", + "rslt: 13790871552 6769606656\n", + "rslt: 13790871552 6769606656\n", + "rslt: 13790871552 6773800960\n", + "rslt: 13774094336 6773800960\n", + "rslt: 13774094336 6773800960\n", + "rslt: 13774094336 6777995264\n", + "rslt: 13757317120 6777995264\n", + "rslt: 13757317120 6777995264\n", + "rslt: 13757317120 6782189568\n", + "rslt: 13740539904 6782189568\n", + "rslt: 13740539904 6782189568\n", + "rslt: 13740539904 6786383872\n", + "rslt: 13723762688 6786383872\n", + "rslt: 13723762688 6786383872\n", + "rslt: 13723762688 6790578176\n", + "rslt: 13706985472 6790578176\n", + "rslt: 13706985472 6790578176\n", + "rslt: 13706985472 6790578176\n", + "rslt: 13690208256 6794772480\n", + "rslt: 13690208256 6794772480\n", + "rslt: 13690208256 6794772480\n", + "rslt: 13673431040 6798966784\n", + "rslt: 13673431040 6798966784\n", + "rslt: 13673431040 6798966784\n", + "rslt: 13656653824 6803161088\n", + "rslt: 13656653824 6803161088\n", + "rslt: 13656653824 6803161088\n", + "rslt: 13639876608 6807355392\n", + "rslt: 13639876608 6807355392\n", + "rslt: 13639876608 6807355392\n", + "rslt: 13623099392 6811549696\n", + "rslt: 13623099392 6811549696\n", + "rslt: 13623099392 6811549696\n", + "rslt: 13606322176 6815744000\n", + "rslt: 13606322176 6815744000\n", + "rslt: 13606322176 6815744000\n", + "rslt: 13589544960 6819938304\n", + "rslt: 13589544960 6819938304\n", + "rslt: 13589544960 6819938304\n", + "rslt: 13572767744 6819938304\n", + "rslt: 13572767744 6824132608\n", + "rslt: 13572767744 6824132608\n", + "rslt: 13555990528 6824132608\n", + "rslt: 13555990528 6828326912\n", + "rslt: 13555990528 6828326912\n", + "rslt: 13539213312 6828326912\n", + "rslt: 13539213312 6832521216\n", + "rslt: 13539213312 6832521216\n", + "rslt: 13522436096 6832521216\n", + "rslt: 13522436096 6836715520\n", + "rslt: 13522436096 6836715520\n", + "rslt: 13505658880 6836715520\n", + "rslt: 13505658880 6840909824\n", + "rslt: 13505658880 6840909824\n", + "rslt: 13488881664 6840909824\n", + "rslt: 13488881664 6845104128\n", + "rslt: 13488881664 6845104128\n", + "rslt: 13472104448 6845104128\n", + "rslt: 13472104448 6849298432\n", + "rslt: 13472104448 6849298432\n", + "rslt: 13455327232 6849298432\n", + "rslt: 13455327232 6849298432\n", + "rslt: 13455327232 6853492736\n", + "rslt: 13438550016 6853492736\n", + "rslt: 13438550016 6853492736\n", + "rslt: 13438550016 6857687040\n", + "rslt: 13421772800 6857687040\n", + "rslt: 13421772800 6857687040\n", + "rslt: 13421772800 6861881344\n", + "rslt: 13404995584 6861881344\n", + "rslt: 13404995584 6861881344\n", + "rslt: 13404995584 6866075648\n", + "rslt: 13388218368 6866075648\n", + "rslt: 13388218368 6866075648\n", + "rslt: 13388218368 6870269952\n", + "rslt: 13371441152 6870269952\n", + "rslt: 13371441152 6870269952\n", + "rslt: 13371441152 6874464256\n", + "rslt: 13354663936 6874464256\n", + "rslt: 13354663936 6874464256\n", + "rslt: 13354663936 6878658560\n", + "rslt: 13337886720 6878658560\n", + "rslt: 13337886720 6878658560\n", + "rslt: 13337886720 6878658560\n", + "rslt: 13321109504 6882852864\n", + "rslt: 13321109504 6882852864\n", + "rslt: 13321109504 6882852864\n", + "rslt: 13304332288 6887047168\n", + "rslt: 13304332288 6887047168\n", + "rslt: 13304332288 6887047168\n", + "rslt: 13287555072 6891241472\n", + "rslt: 13287555072 6891241472\n", + "rslt: 13287555072 6891241472\n", + "rslt: 13270777856 6895435776\n", + "rslt: 13270777856 6895435776\n", + "rslt: 13270777856 6895435776\n", + "rslt: 13254000640 6899630080\n", + "rslt: 13254000640 6899630080\n", + "rslt: 13254000640 6899630080\n", + "rslt: 13237223424 6903824384\n", + "rslt: 13237223424 6903824384\n", + "rslt: 13237223424 6903824384\n", + "rslt: 13220446208 6908018688\n", + "rslt: 13220446208 6908018688\n", + "rslt: 13220446208 6908018688\n", + "rslt: 13203668992 6908018688\n", + "rslt: 13203668992 6912212992\n", + "rslt: 13203668992 6912212992\n", + "rslt: 13186891776 6912212992\n", + "rslt: 13186891776 6916407296\n", + "rslt: 13186891776 6916407296\n", + "rslt: 13170114560 6916407296\n", + "rslt: 13170114560 6920601600\n", + "rslt: 13170114560 6920601600\n", + "rslt: 13153337344 6920601600\n", + "rslt: 13153337344 6924795904\n", + "rslt: 13153337344 6924795904\n", + "rslt: 13136560128 6924795904\n", + "rslt: 13136560128 6928990208\n", + "rslt: 13136560128 6928990208\n", + "rslt: 13119782912 6928990208\n", + "rslt: 13119782912 6933184512\n", + "rslt: 13119782912 6933184512\n", + "rslt: 13103005696 6933184512\n", + "rslt: 13103005696 6933184512\n", + "rslt: 13103005696 6937378816\n", + "rslt: 13086228480 6937378816\n", + "rslt: 13086228480 6937378816\n", + "rslt: 13086228480 6941573120\n", + "rslt: 13069451264 6941573120\n", + "rslt: 13069451264 6941573120\n", + "rslt: 13069451264 6945767424\n", + "rslt: 13052674048 6945767424\n", + "rslt: 13052674048 6945767424\n", + "rslt: 13052674048 6949961728\n", + "rslt: 13035896832 6949961728\n", + "rslt: 13035896832 6949961728\n", + "rslt: 13035896832 6954156032\n", + "rslt: 13019119616 6954156032\n", + "rslt: 13019119616 6954156032\n", + "rslt: 13019119616 6958350336\n", + "rslt: 13002342400 6958350336\n", + "rslt: 13002342400 6958350336\n", + "rslt: 13002342400 6962544640\n", + "rslt: 12985565184 6962544640\n", + "rslt: 12985565184 6962544640\n", + "rslt: 12985565184 6962544640\n", + "rslt: 12968787968 6966738944\n", + "rslt: 12968787968 6966738944\n", + "rslt: 12968787968 6966738944\n", + "rslt: 12952010752 6970933248\n", + "rslt: 12952010752 6970933248\n", + "rslt: 12952010752 6970933248\n", + "rslt: 12952010752 6975127552\n", + "rslt: 12935233536 6975127552\n", + "rslt: 12935233536 6975127552\n", + "rslt: 12935233536 6979321856\n", + "rslt: 12918456320 6979321856\n", + "rslt: 12918456320 6979321856\n", + "rslt: 12918456320 6983516160\n", + "rslt: 12901679104 6983516160\n", + "rslt: 12901679104 6983516160\n", + "rslt: 12901679104 6987710464\n", + "rslt: 12884901888 6987710464\n", + "rslt: 12884901888 6987710464\n", + "rslt: 12884901888 6991904768\n", + "rslt: 12868124672 6991904768\n", + "rslt: 12868124672 6991904768\n", + "rslt: 12868124672 6991904768\n", + "rslt: 12851347456 6996099072\n", + "rslt: 12851347456 6996099072\n", + "rslt: 12851347456 6996099072\n", + "rslt: 12834570240 7000293376\n", + "rslt: 12834570240 7000293376\n", + "rslt: 12834570240 7000293376\n", + "rslt: 12817793024 7004487680\n", + "rslt: 12817793024 7004487680\n", + "rslt: 12817793024 7004487680\n", + "rslt: 12801015808 7008681984\n", + "rslt: 12801015808 7008681984\n", + "rslt: 12801015808 7008681984\n", + "rslt: 12784238592 7012876288\n", + "rslt: 12784238592 7012876288\n", + "rslt: 12784238592 7012876288\n", + "rslt: 12767461376 7017070592\n", + "rslt: 12767461376 7017070592\n", + "rslt: 12767461376 7017070592\n", + "rslt: 12750684160 7021264896\n", + "rslt: 12750684160 7021264896\n", + "rslt: 12750684160 7021264896\n", + "rslt: 12733906944 7021264896\n", + "rslt: 12733906944 7025459200\n", + "rslt: 12733906944 7025459200\n", + "rslt: 12717129728 7025459200\n", + "rslt: 12717129728 7029653504\n", + "rslt: 12717129728 7029653504\n", + "rslt: 12700352512 7029653504\n", + "rslt: 12700352512 7033847808\n", + "rslt: 12700352512 7033847808\n", + "rslt: 12683575296 7033847808\n", + "rslt: 12683575296 7038042112\n", + "rslt: 12683575296 7038042112\n", + "rslt: 12666798080 7038042112\n", + "rslt: 12666798080 7042236416\n", + "rslt: 12666798080 7042236416\n", + "rslt: 12650020864 7042236416\n", + "rslt: 12650020864 7046430720\n", + "rslt: 12650020864 7046430720\n", + "rslt: 12633243648 7046430720\n", + "rslt: 12633243648 7050625024\n", + "rslt: 12633243648 7050625024\n", + "rslt: 12616466432 7050625024\n", + "rslt: 12616466432 7050625024\n", + "rslt: 12616466432 7054819328\n", + "rslt: 12599689216 7054819328\n", + "rslt: 12599689216 7054819328\n", + "rslt: 12599689216 7059013632\n", + "rslt: 12582912000 7059013632\n", + "rslt: 12582912000 7059013632\n", + "rslt: 12582912000 7063207936\n", + "rslt: 12566134784 7063207936\n", + "rslt: 12566134784 7063207936\n", + "rslt: 12566134784 7067402240\n", + "rslt: 12549357568 7067402240\n", + "rslt: 12549357568 7067402240\n", + "rslt: 12549357568 7071596544\n", + "rslt: 12532580352 7071596544\n", + "rslt: 12532580352 7071596544\n", + "rslt: 12532580352 7075790848\n", + "rslt: 12515803136 7075790848\n", + "rslt: 12515803136 7075790848\n", + "rslt: 12515803136 7079985152\n", + "rslt: 12499025920 7079985152\n", + "rslt: 12499025920 7079985152\n", + "rslt: 12499025920 7079985152\n", + "rslt: 12482248704 7084179456\n", + "rslt: 12482248704 7084179456\n", + "rslt: 12482248704 7084179456\n", + "rslt: 12465471488 7088373760\n", + "rslt: 12465471488 7088373760\n", + "rslt: 12465471488 7088373760\n", + "rslt: 12448694272 7092568064\n", + "rslt: 12448694272 7092568064\n", + "rslt: 12448694272 7092568064\n", + "rslt: 12431917056 7096762368\n", + "rslt: 12431917056 7096762368\n", + "rslt: 12431917056 7096762368\n", + "rslt: 12415139840 7100956672\n", + "rslt: 12415139840 7100956672\n", + "rslt: 12415139840 7100956672\n", + "rslt: 12398362624 7105150976\n", + "rslt: 12398362624 7105150976\n", + "rslt: 12398362624 7105150976\n", + "rslt: 12381585408 7109345280\n", + "rslt: 12381585408 7109345280\n", + "rslt: 12381585408 7109345280\n", + "rslt: 12364808192 7109345280\n", + "rslt: 12364808192 7113539584\n", + "rslt: 12364808192 7113539584\n", + "rslt: 12348030976 7113539584\n", + "rslt: 12348030976 7117733888\n", + "rslt: 12348030976 7117733888\n", + "rslt: 12331253760 7117733888\n", + "rslt: 12331253760 7121928192\n", + "rslt: 12331253760 7121928192\n", + "rslt: 12314476544 7121928192\n", + "rslt: 12314476544 7126122496\n", + "rslt: 12314476544 7126122496\n", + "rslt: 12297699328 7126122496\n", + "rslt: 12297699328 7130316800\n", + "rslt: 12297699328 7130316800\n", + "rslt: 12280922112 7130316800\n", + "rslt: 12280922112 7134511104\n", + "rslt: 12280922112 7134511104\n", + "rslt: 12264144896 7134511104\n", + "rslt: 12264144896 7134511104\n", + "rslt: 12264144896 7138705408\n", + "rslt: 12247367680 7138705408\n", + "rslt: 12247367680 7138705408\n", + "rslt: 12247367680 7142899712\n", + "rslt: 12230590464 7142899712\n", + "rslt: 12230590464 7142899712\n", + "rslt: 12230590464 7147094016\n", + "rslt: 12213813248 7147094016\n", + "rslt: 12213813248 7147094016\n", + "rslt: 12213813248 7151288320\n", + "rslt: 12197036032 7151288320\n", + "rslt: 12197036032 7151288320\n", + "rslt: 12197036032 7155482624\n", + "rslt: 12180258816 7155482624\n", + "rslt: 12180258816 7155482624\n", + "rslt: 12180258816 7159676928\n", + "rslt: 12163481600 7159676928\n", + "rslt: 12163481600 7159676928\n", + "rslt: 12163481600 7163871232\n", + "rslt: 12146704384 7163871232\n", + "rslt: 12146704384 7163871232\n", + "rslt: 12146704384 7163871232\n", + "rslt: 12129927168 7168065536\n", + "rslt: 12129927168 7168065536\n", + "rslt: 12129927168 7168065536\n", + "rslt: 12113149952 7172259840\n", + "rslt: 12113149952 7172259840\n", + "rslt: 12113149952 7172259840\n", + "rslt: 12096372736 7176454144\n", + "rslt: 12096372736 7176454144\n", + "rslt: 12096372736 7176454144\n", + "rslt: 12079595520 7180648448\n", + "rslt: 12079595520 7180648448\n", + "rslt: 12079595520 7180648448\n", + "rslt: 12062818304 7184842752\n", + "rslt: 12062818304 7184842752\n", + "rslt: 12062818304 7184842752\n", + "rslt: 12046041088 7189037056\n", + "rslt: 12046041088 7189037056\n", + "rslt: 12046041088 7189037056\n", + "rslt: 12029263872 7193231360\n", + "rslt: 12029263872 7193231360\n", + "rslt: 12029263872 7193231360\n", + "rslt: 12012486656 7193231360\n", + "rslt: 12012486656 7197425664\n", + "rslt: 12012486656 7197425664\n", + "rslt: 11995709440 7197425664\n", + "rslt: 11995709440 7201619968\n", + "rslt: 11995709440 7201619968\n", + "rslt: 11978932224 7201619968\n", + "rslt: 11978932224 7205814272\n", + "rslt: 11978932224 7205814272\n", + "rslt: 11962155008 7205814272\n", + "rslt: 11962155008 7210008576\n", + "rslt: 11962155008 7210008576\n", + "rslt: 11945377792 7210008576\n", + "rslt: 11945377792 7214202880\n", + "rslt: 11945377792 7214202880\n", + "rslt: 11928600576 7214202880\n", + "rslt: 11928600576 7218397184\n", + "rslt: 11928600576 7218397184\n", + "rslt: 11911823360 7218397184\n", + "rslt: 11911823360 7222591488\n", + "rslt: 11911823360 7222591488\n", + "rslt: 11895046144 7222591488\n", + "rslt: 11895046144 7222591488\n", + "rslt: 11895046144 7226785792\n", + "rslt: 11878268928 7226785792\n", + "rslt: 11878268928 7226785792\n", + "rslt: 11878268928 7230980096\n", + "rslt: 11861491712 7230980096\n", + "rslt: 11861491712 7230980096\n", + "rslt: 11861491712 7235174400\n", + "rslt: 11844714496 7235174400\n", + "rslt: 11844714496 7235174400\n", + "rslt: 11844714496 7239368704\n", + "rslt: 11827937280 7239368704\n", + "rslt: 11827937280 7239368704\n", + "rslt: 11827937280 7243563008\n", + "rslt: 11811160064 7243563008\n", + "rslt: 11811160064 7243563008\n", + "rslt: 11811160064 7247757312\n", + "rslt: 11794382848 7247757312\n", + "rslt: 11794382848 7247757312\n", + "rslt: 11794382848 7251951616\n", + "rslt: 11777605632 7251951616\n", + "rslt: 11777605632 7251951616\n", + "rslt: 11777605632 7251951616\n", + "rslt: 11777605632 7256145920\n", + "rslt: 11760828416 7256145920\n", + "rslt: 11760828416 7256145920\n", + "rslt: 11760828416 7260340224\n", + "rslt: 11744051200 7260340224\n", + "rslt: 11744051200 7260340224\n", + "rslt: 11744051200 7264534528\n", + "rslt: 11727273984 7264534528\n", + "rslt: 11727273984 7264534528\n", + "rslt: 11727273984 7268728832\n", + "rslt: 11710496768 7268728832\n", + "rslt: 11710496768 7268728832\n", + "rslt: 11710496768 7272923136\n", + "rslt: 11693719552 7272923136\n", + "rslt: 11693719552 7272923136\n", + "rslt: 11693719552 7277117440\n", + "rslt: 11676942336 7277117440\n", + "rslt: 11676942336 7277117440\n", + "rslt: 11676942336 7281311744\n", + "rslt: 11660165120 7281311744\n", + "rslt: 11660165120 7281311744\n", + "rslt: 11660165120 7281311744\n", + "rslt: 11643387904 7285506048\n", + "rslt: 11643387904 7285506048\n", + "rslt: 11643387904 7285506048\n", + "rslt: 11626610688 7289700352\n", + "rslt: 11626610688 7289700352\n", + "rslt: 11626610688 7289700352\n", + "rslt: 11609833472 7293894656\n", + "rslt: 11609833472 7293894656\n", + "rslt: 11609833472 7293894656\n", + "rslt: 11593056256 7298088960\n", + "rslt: 11593056256 7298088960\n", + "rslt: 11593056256 7298088960\n", + "rslt: 11576279040 7302283264\n", + "rslt: 11576279040 7302283264\n", + "rslt: 11576279040 7302283264\n", + "rslt: 11559501824 7306477568\n", + "rslt: 11559501824 7306477568\n", + "rslt: 11559501824 7306477568\n", + "rslt: 11542724608 7310671872\n", + "rslt: 11542724608 7310671872\n", + "rslt: 11542724608 7310671872\n", + "rslt: 11525947392 7310671872\n", + "rslt: 11525947392 7314866176\n", + "rslt: 11525947392 7314866176\n", + "rslt: 11509170176 7314866176\n", + "rslt: 11509170176 7319060480\n", + "rslt: 11509170176 7319060480\n", + "rslt: 11492392960 7319060480\n", + "rslt: 11492392960 7323254784\n", + "rslt: 11492392960 7323254784\n", + "rslt: 11475615744 7323254784\n", + "rslt: 11475615744 7327449088\n", + "rslt: 11475615744 7327449088\n", + "rslt: 11458838528 7327449088\n", + "rslt: 11458838528 7331643392\n", + "rslt: 11458838528 7331643392\n", + "rslt: 11442061312 7331643392\n", + "rslt: 11442061312 7335837696\n", + "rslt: 11442061312 7335837696\n", + "rslt: 11425284096 7335837696\n", + "rslt: 11425284096 7335837696\n", + "rslt: 11425284096 7340032000\n", + "rslt: 11408506880 7340032000\n", + "rslt: 11408506880 7340032000\n", + "rslt: 11408506880 7344226304\n", + "rslt: 11391729664 7344226304\n", + "rslt: 11391729664 7344226304\n", + "rslt: 11391729664 7348420608\n", + "rslt: 11374952448 7348420608\n", + "rslt: 11374952448 7348420608\n", + "rslt: 11374952448 7352614912\n", + "rslt: 11358175232 7352614912\n", + "rslt: 11358175232 7352614912\n", + "rslt: 11358175232 7356809216\n", + "rslt: 11341398016 7356809216\n", + "rslt: 11341398016 7356809216\n", + "rslt: 11341398016 7361003520\n", + "rslt: 11324620800 7361003520\n", + "rslt: 11324620800 7361003520\n", + "rslt: 11324620800 7365197824\n", + "rslt: 11307843584 7365197824\n", + "rslt: 11307843584 7365197824\n", + "rslt: 11307843584 7365197824\n", + "rslt: 11291066368 7369392128\n", + "rslt: 11291066368 7369392128\n", + "rslt: 11291066368 7369392128\n", + "rslt: 11274289152 7373586432\n", + "rslt: 11274289152 7373586432\n", + "rslt: 11274289152 7373586432\n", + "rslt: 11257511936 7377780736\n", + "rslt: 11257511936 7377780736\n", + "rslt: 11257511936 7377780736\n", + "rslt: 11240734720 7381975040\n", + "rslt: 11240734720 7381975040\n", + "rslt: 11240734720 7381975040\n", + "rslt: 11223957504 7386169344\n", + "rslt: 11223957504 7386169344\n", + "rslt: 11223957504 7386169344\n", + "rslt: 11207180288 7390363648\n", + "rslt: 11207180288 7390363648\n", + "rslt: 11207180288 7390363648\n", + "rslt: 11190403072 7394557952\n", + "rslt: 11190403072 7394557952\n", + "rslt: 11190403072 7394557952\n", + "rslt: 11173625856 7394557952\n", + "rslt: 11173625856 7398752256\n", + "rslt: 11173625856 7398752256\n", + "rslt: 11156848640 7398752256\n", + "rslt: 11156848640 7402946560\n", + "rslt: 11156848640 7402946560\n", + "rslt: 11140071424 7402946560\n", + "rslt: 11140071424 7407140864\n", + "rslt: 11140071424 7407140864\n", + "rslt: 11123294208 7407140864\n", + "rslt: 11123294208 7411335168\n", + "rslt: 11123294208 7411335168\n", + "rslt: 11106516992 7411335168\n", + "rslt: 11106516992 7415529472\n", + "rslt: 11106516992 7415529472\n", + "rslt: 11089739776 7415529472\n", + "rslt: 11089739776 7419723776\n", + "rslt: 11089739776 7419723776\n", + "rslt: 11072962560 7419723776\n", + "rslt: 11072962560 7423918080\n", + "rslt: 11072962560 7423918080\n", + "rslt: 11056185344 7423918080\n", + "rslt: 11056185344 7423918080\n", + "rslt: 11056185344 7428112384\n", + "rslt: 11039408128 7428112384\n", + "rslt: 11039408128 7428112384\n", + "rslt: 11039408128 7432306688\n", + "rslt: 11022630912 7432306688\n", + "rslt: 11022630912 7432306688\n", + "rslt: 11022630912 7436500992\n", + "rslt: 11005853696 7436500992\n", + "rslt: 11005853696 7436500992\n", + "rslt: 11005853696 7440695296\n", + "rslt: 10989076480 7440695296\n", + "rslt: 10989076480 7440695296\n", + "rslt: 10989076480 7444889600\n", + "rslt: 10972299264 7444889600\n", + "rslt: 10972299264 7444889600\n", + "rslt: 10972299264 7449083904\n", + "rslt: 10955522048 7449083904\n", + "rslt: 10955522048 7449083904\n", + "rslt: 10955522048 7453278208\n", + "rslt: 10938744832 7453278208\n", + "rslt: 10938744832 7453278208\n", + "rslt: 10938744832 7453278208\n", + "rslt: 10921967616 7457472512\n", + "rslt: 10921967616 7457472512\n", + "rslt: 10921967616 7457472512\n", + "rslt: 10905190400 7461666816\n", + "rslt: 10905190400 7461666816\n", + "rslt: 10905190400 7461666816\n", + "rslt: 10888413184 7465861120\n", + "rslt: 10888413184 7465861120\n", + "rslt: 10888413184 7465861120\n", + "rslt: 10871635968 7470055424\n", + "rslt: 10871635968 7470055424\n", + "rslt: 10871635968 7470055424\n", + "rslt: 10854858752 7474249728\n", + "rslt: 10854858752 7474249728\n", + "rslt: 10854858752 7474249728\n", + "rslt: 10838081536 7478444032\n", + "rslt: 10838081536 7478444032\n", + "rslt: 10838081536 7478444032\n", + "rslt: 10821304320 7482638336\n", + "rslt: 10821304320 7482638336\n", + "rslt: 10821304320 7482638336\n", + "rslt: 10804527104 7482638336\n", + "rslt: 10804527104 7486832640\n", + "rslt: 10804527104 7486832640\n", + "rslt: 10787749888 7486832640\n", + "rslt: 10787749888 7491026944\n", + "rslt: 10787749888 7491026944\n", + "rslt: 10770972672 7491026944\n", + "rslt: 10770972672 7495221248\n", + "rslt: 10770972672 7495221248\n", + "rslt: 10754195456 7495221248\n", + "rslt: 10754195456 7499415552\n", + "rslt: 10754195456 7499415552\n", + "rslt: 10737418240 7499415552\n", + "rslt: 10737418240 7503609856\n", + "rslt: 10737418240 7503609856\n", + "rslt: 10720641024 7503609856\n", + "rslt: 10720641024 7507804160\n", + "rslt: 10720641024 7507804160\n", + "rslt: 10703863808 7507804160\n", + "rslt: 10703863808 7511998464\n", + "rslt: 10703863808 7511998464\n", + "rslt: 10687086592 7511998464\n", + "rslt: 10687086592 7511998464\n", + "rslt: 10687086592 7516192768\n", + "rslt: 10670309376 7516192768\n", + "rslt: 10670309376 7516192768\n", + "rslt: 10670309376 7520387072\n", + "rslt: 10653532160 7520387072\n", + "rslt: 10653532160 7520387072\n", + "rslt: 10653532160 7524581376\n", + "rslt: 10636754944 7524581376\n", + "rslt: 10636754944 7524581376\n", + "rslt: 10636754944 7528775680\n", + "rslt: 10619977728 7528775680\n", + "rslt: 10619977728 7528775680\n", + "rslt: 10619977728 7532969984\n", + "rslt: 10619977728 7532969984\n", + "rslt: 10603200512 7532969984\n", + "rslt: 10603200512 7537164288\n", + "rslt: 10603200512 7537164288\n", + "rslt: 10586423296 7537164288\n", + "rslt: 10586423296 7537164288\n", + "rslt: 10586423296 7541358592\n", + "rslt: 10569646080 7541358592\n", + "rslt: 10569646080 7541358592\n", + "rslt: 10569646080 7545552896\n", + "rslt: 10552868864 7545552896\n", + "rslt: 10552868864 7545552896\n", + "rslt: 10552868864 7549747200\n", + "rslt: 10536091648 7549747200\n", + "rslt: 10536091648 7549747200\n", + "rslt: 10536091648 7553941504\n", + "rslt: 10519314432 7553941504\n", + "rslt: 10519314432 7553941504\n", + "rslt: 10519314432 7558135808\n", + "rslt: 10502537216 7558135808\n", + "rslt: 10502537216 7558135808\n", + "rslt: 10502537216 7562330112\n", + "rslt: 10485760000 7562330112\n", + "rslt: 10485760000 7562330112\n", + "rslt: 10485760000 7566524416\n", + "rslt: 10468982784 7566524416\n", + "rslt: 10468982784 7566524416\n", + "rslt: 10468982784 7566524416\n", + "rslt: 10452205568 7570718720\n", + "rslt: 10452205568 7570718720\n", + "rslt: 10452205568 7570718720\n", + "rslt: 10435428352 7574913024\n", + "rslt: 10435428352 7574913024\n", + "rslt: 10435428352 7574913024\n", + "rslt: 10418651136 7579107328\n", + "rslt: 10418651136 7579107328\n", + "rslt: 10418651136 7579107328\n", + "rslt: 10401873920 7583301632\n", + "rslt: 10401873920 7583301632\n", + "rslt: 10401873920 7583301632\n", + "rslt: 10385096704 7587495936\n", + "rslt: 10385096704 7587495936\n", + "rslt: 10385096704 7587495936\n", + "rslt: 10368319488 7591690240\n", + "rslt: 10368319488 7591690240\n", + "rslt: 10368319488 7591690240\n", + "rslt: 10351542272 7595884544\n", + "rslt: 10351542272 7595884544\n", + "rslt: 10351542272 7595884544\n", + "rslt: 10334765056 7595884544\n", + "rslt: 10334765056 7600078848\n", + "rslt: 10334765056 7600078848\n", + "rslt: 10317987840 7600078848\n", + "rslt: 10317987840 7604273152\n", + "rslt: 10317987840 7604273152\n", + "rslt: 10301210624 7604273152\n", + "rslt: 10301210624 7608467456\n", + "rslt: 10301210624 7608467456\n", + "rslt: 10284433408 7608467456\n", + "rslt: 10284433408 7612661760\n", + "rslt: 10284433408 7612661760\n", + "rslt: 10267656192 7612661760\n", + "rslt: 10267656192 7616856064\n", + "rslt: 10267656192 7616856064\n", + "rslt: 10250878976 7616856064\n", + "rslt: 10250878976 7621050368\n", + "rslt: 10250878976 7621050368\n", + "rslt: 10234101760 7621050368\n", + "rslt: 10234101760 7625244672\n", + "rslt: 10234101760 7625244672\n", + "rslt: 10217324544 7625244672\n", + "rslt: 10217324544 7625244672\n", + "rslt: 10217324544 7629438976\n", + "rslt: 10200547328 7629438976\n", + "rslt: 10200547328 7629438976\n", + "rslt: 10200547328 7633633280\n", + "rslt: 10183770112 7633633280\n", + "rslt: 10183770112 7633633280\n", + "rslt: 10183770112 7637827584\n", + "rslt: 10166992896 7637827584\n", + "rslt: 10166992896 7637827584\n", + "rslt: 10166992896 7642021888\n", + "rslt: 10150215680 7642021888\n", + "rslt: 10150215680 7642021888\n", + "rslt: 10150215680 7646216192\n", + "rslt: 10133438464 7646216192\n", + "rslt: 10133438464 7646216192\n", + "rslt: 10133438464 7650410496\n", + "rslt: 10116661248 7650410496\n", + "rslt: 10116661248 7650410496\n", + "rslt: 10116661248 7654604800\n", + "rslt: 10099884032 7654604800\n", + "rslt: 10099884032 7654604800\n", + "rslt: 10099884032 7654604800\n", + "rslt: 10083106816 7658799104\n", + "rslt: 10083106816 7658799104\n", + "rslt: 10083106816 7658799104\n", + "rslt: 10066329600 7662993408\n", + "rslt: 10066329600 7662993408\n", + "rslt: 10066329600 7662993408\n", + "rslt: 10049552384 7667187712\n", + "rslt: 10049552384 7667187712\n", + "rslt: 10049552384 7667187712\n", + "rslt: 10032775168 7671382016\n", + "rslt: 10032775168 7671382016\n", + "rslt: 10032775168 7671382016\n", + "rslt: 10015997952 7675576320\n", + "rslt: 10015997952 7675576320\n", + "rslt: 10015997952 7675576320\n", + "rslt: 9999220736 7679770624\n", + "rslt: 9999220736 7679770624\n", + "rslt: 9999220736 7679770624\n", + "rslt: 9982443520 7683964928\n", + "rslt: 9982443520 7683964928\n", + "rslt: 9982443520 7683964928\n", + "rslt: 9965666304 7683964928\n", + "rslt: 9965666304 7688159232\n", + "rslt: 9965666304 7688159232\n", + "rslt: 9948889088 7688159232\n", + "rslt: 9948889088 7692353536\n", + "rslt: 9948889088 7692353536\n", + "rslt: 9932111872 7692353536\n", + "rslt: 9932111872 7696547840\n", + "rslt: 9932111872 7696547840\n", + "rslt: 9915334656 7696547840\n", + "rslt: 9915334656 7700742144\n", + "rslt: 9915334656 7700742144\n", + "rslt: 9898557440 7700742144\n", + "rslt: 9898557440 7704936448\n", + "rslt: 9898557440 7704936448\n", + "rslt: 9881780224 7704936448\n", + "rslt: 9881780224 7709130752\n", + "rslt: 9881780224 7709130752\n", + "rslt: 9865003008 7709130752\n", + "rslt: 9865003008 7713325056\n", + "rslt: 9865003008 7713325056\n", + "rslt: 9848225792 7713325056\n", + "rslt: 9848225792 7713325056\n", + "rslt: 9848225792 7717519360\n", + "rslt: 9831448576 7717519360\n", + "rslt: 9831448576 7717519360\n", + "rslt: 9831448576 7721713664\n", + "rslt: 9814671360 7721713664\n", + "rslt: 9814671360 7721713664\n", + "rslt: 9814671360 7725907968\n", + "rslt: 9797894144 7725907968\n", + "rslt: 9797894144 7725907968\n", + "rslt: 9797894144 7730102272\n", + "rslt: 9781116928 7730102272\n", + "rslt: 9781116928 7730102272\n", + "rslt: 9781116928 7734296576\n", + "rslt: 9764339712 7734296576\n", + "rslt: 9764339712 7734296576\n", + "rslt: 9764339712 7738490880\n", + "rslt: 9747562496 7738490880\n", + "rslt: 9747562496 7738490880\n", + "rslt: 9747562496 7738490880\n", + "rslt: 9730785280 7742685184\n", + "rslt: 9730785280 7742685184\n", + "rslt: 9730785280 7742685184\n", + "rslt: 9714008064 7746879488\n", + "rslt: 9714008064 7746879488\n", + "rslt: 9714008064 7746879488\n", + "rslt: 9697230848 7751073792\n", + "rslt: 9697230848 7751073792\n", + "rslt: 9697230848 7751073792\n", + "rslt: 9680453632 7755268096\n", + "rslt: 9680453632 7755268096\n", + "rslt: 9680453632 7755268096\n", + "rslt: 9663676416 7759462400\n", + "rslt: 9663676416 7759462400\n", + "rslt: 9663676416 7759462400\n", + "rslt: 9646899200 7763656704\n", + "rslt: 9646899200 7763656704\n", + "rslt: 9646899200 7763656704\n", + "rslt: 9630121984 7767851008\n", + "rslt: 9630121984 7767851008\n", + "rslt: 9630121984 7767851008\n", + "rslt: 9613344768 7767851008\n", + "rslt: 9613344768 7772045312\n", + "rslt: 9613344768 7772045312\n", + "rslt: 9596567552 7772045312\n", + "rslt: 9596567552 7776239616\n", + "rslt: 9596567552 7776239616\n", + "rslt: 9579790336 7776239616\n", + "rslt: 9579790336 7780433920\n", + "rslt: 9579790336 7780433920\n", + "rslt: 9563013120 7780433920\n", + "rslt: 9563013120 7784628224\n", + "rslt: 9563013120 7784628224\n", + "rslt: 9546235904 7784628224\n", + "rslt: 9546235904 7788822528\n", + "rslt: 9546235904 7788822528\n", + "rslt: 9529458688 7788822528\n", + "rslt: 9529458688 7793016832\n", + "rslt: 9529458688 7793016832\n", + "rslt: 9512681472 7793016832\n", + "rslt: 9512681472 7797211136\n", + "rslt: 9512681472 7797211136\n", + "rslt: 9495904256 7797211136\n", + "rslt: 9495904256 7797211136\n", + "rslt: 9495904256 7801405440\n", + "rslt: 9479127040 7801405440\n", + "rslt: 9479127040 7801405440\n", + "rslt: 9479127040 7805599744\n", + "rslt: 9462349824 7805599744\n", + "rslt: 9462349824 7805599744\n", + "rslt: 9462349824 7809794048\n", + "rslt: 9462349824 7809794048\n", + "rslt: 9445572608 7809794048\n", + "rslt: 9445572608 7813988352\n", + "rslt: 9445572608 7813988352\n", + "rslt: 9428795392 7813988352\n", + "rslt: 9428795392 7818182656\n", + "rslt: 9428795392 7818182656\n", + "rslt: 9412018176 7818182656\n", + "rslt: 9412018176 7822376960\n", + "rslt: 9412018176 7822376960\n", + "rslt: 9395240960 7822376960\n", + "rslt: 9395240960 7826571264\n", + "rslt: 9395240960 7826571264\n", + "rslt: 9378463744 7826571264\n", + "rslt: 9378463744 7826571264\n", + "rslt: 9378463744 7830765568\n", + "rslt: 9361686528 7830765568\n", + "rslt: 9361686528 7830765568\n", + "rslt: 9361686528 7834959872\n", + "rslt: 9344909312 7834959872\n", + "rslt: 9344909312 7834959872\n", + "rslt: 9344909312 7839154176\n", + "rslt: 9328132096 7839154176\n", + "rslt: 9328132096 7839154176\n", + "rslt: 9328132096 7843348480\n", + "rslt: 9311354880 7843348480\n", + "rslt: 9311354880 7843348480\n", + "rslt: 9311354880 7847542784\n", + "rslt: 9294577664 7847542784\n", + "rslt: 9294577664 7847542784\n", + "rslt: 9294577664 7851737088\n", + "rslt: 9277800448 7851737088\n", + "rslt: 9277800448 7851737088\n", + "rslt: 9277800448 7855931392\n", + "rslt: 9261023232 7855931392\n", + "rslt: 9261023232 7855931392\n", + "rslt: 9261023232 7855931392\n", + "rslt: 9244246016 7860125696\n", + "rslt: 9244246016 7860125696\n", + "rslt: 9244246016 7860125696\n", + "rslt: 9227468800 7864320000\n", + "rslt: 9227468800 7864320000\n", + "rslt: 9227468800 7864320000\n", + "rslt: 9210691584 7868514304\n", + "rslt: 9210691584 7868514304\n", + "rslt: 9210691584 7868514304\n", + "rslt: 9193914368 7872708608\n", + "rslt: 9193914368 7872708608\n", + "rslt: 9193914368 7872708608\n", + "rslt: 9177137152 7876902912\n", + "rslt: 9177137152 7876902912\n", + "rslt: 9177137152 7876902912\n", + "rslt: 9160359936 7881097216\n", + "rslt: 9160359936 7881097216\n", + "rslt: 9160359936 7881097216\n", + "rslt: 9143582720 7885291520\n", + "rslt: 9143582720 7885291520\n", + "rslt: 9143582720 7885291520\n", + "rslt: 9126805504 7885291520\n", + "rslt: 9126805504 7889485824\n", + "rslt: 9126805504 7889485824\n", + "rslt: 9110028288 7889485824\n", + "rslt: 9110028288 7893680128\n", + "rslt: 9110028288 7893680128\n", + "rslt: 9093251072 7893680128\n", + "rslt: 9093251072 7897874432\n", + "rslt: 9093251072 7897874432\n", + "rslt: 9076473856 7897874432\n", + "rslt: 9076473856 7902068736\n", + "rslt: 9076473856 7902068736\n", + "rslt: 9059696640 7902068736\n", + "rslt: 9059696640 7906263040\n", + "rslt: 9059696640 7906263040\n", + "rslt: 9042919424 7906263040\n", + "rslt: 9042919424 7910457344\n", + "rslt: 9042919424 7910457344\n", + "rslt: 9026142208 7910457344\n", + "rslt: 9026142208 7914651648\n", + "rslt: 9026142208 7914651648\n", + "rslt: 9009364992 7914651648\n", + "rslt: 9009364992 7914651648\n", + "rslt: 9009364992 7918845952\n", + "rslt: 8992587776 7918845952\n", + "rslt: 8992587776 7918845952\n", + "rslt: 8992587776 7923040256\n", + "rslt: 8975810560 7923040256\n", + "rslt: 8975810560 7923040256\n", + "rslt: 8975810560 7927234560\n", + "rslt: 8959033344 7927234560\n", + "rslt: 8959033344 7927234560\n", + "rslt: 8959033344 7931428864\n", + "rslt: 8942256128 7931428864\n", + "rslt: 8942256128 7931428864\n", + "rslt: 8942256128 7935623168\n", + "rslt: 8925478912 7935623168\n", + "rslt: 8925478912 7935623168\n", + "rslt: 8925478912 7939817472\n", + "rslt: 8908701696 7939817472\n", + "rslt: 8908701696 7939817472\n", + "rslt: 8908701696 7939817472\n", + "rslt: 8891924480 7944011776\n", + "rslt: 8891924480 7944011776\n", + "rslt: 8891924480 7944011776\n", + "rslt: 8875147264 7948206080\n", + "rslt: 8875147264 7948206080\n", + "rslt: 8875147264 7948206080\n", + "rslt: 8858370048 7952400384\n", + "rslt: 8858370048 7952400384\n", + "rslt: 8858370048 7952400384\n", + "rslt: 8841592832 7956594688\n", + "rslt: 8841592832 7956594688\n", + "rslt: 8841592832 7956594688\n", + "rslt: 8824815616 7960788992\n", + "rslt: 8824815616 7960788992\n", + "rslt: 8824815616 7960788992\n", + "rslt: 8808038400 7964983296\n", + "rslt: 8808038400 7964983296\n", + "rslt: 8808038400 7964983296\n", + "rslt: 8791261184 7969177600\n", + "rslt: 8791261184 7969177600\n", + "rslt: 8791261184 7969177600\n", + "rslt: 8774483968 7969177600\n", + "rslt: 8774483968 7973371904\n", + "rslt: 8774483968 7973371904\n", + "rslt: 8757706752 7973371904\n", + "rslt: 8757706752 7977566208\n", + "rslt: 8757706752 7977566208\n", + "rslt: 8740929536 7977566208\n", + "rslt: 8740929536 7981760512\n", + "rslt: 8740929536 7981760512\n", + "rslt: 8724152320 7981760512\n", + "rslt: 8724152320 7985954816\n", + "rslt: 8724152320 7985954816\n", + "rslt: 8707375104 7985954816\n", + "rslt: 8707375104 7990149120\n", + "rslt: 8707375104 7990149120\n", + "rslt: 8690597888 7990149120\n", + "rslt: 8690597888 7994343424\n", + "rslt: 8690597888 7994343424\n", + "rslt: 8673820672 7994343424\n", + "rslt: 8673820672 7998537728\n", + "rslt: 8673820672 7998537728\n", + "rslt: 8657043456 7998537728\n", + "rslt: 8657043456 7998537728\n", + "rslt: 8657043456 8002732032\n", + "rslt: 8640266240 8002732032\n", + "rslt: 8640266240 8002732032\n", + "rslt: 8640266240 8006926336\n", + "rslt: 8623489024 8006926336\n", + "rslt: 8623489024 8006926336\n", + "rslt: 8623489024 8011120640\n", + "rslt: 8606711808 8011120640\n", + "rslt: 8606711808 8011120640\n", + "rslt: 8606711808 8015314944\n", + "rslt: 8589934592 8015314944\n", + "rslt: 8589934592 8015314944\n", + "rslt: 8589934592 8019509248\n", + "rslt: 8573157376 8019509248\n", + "rslt: 8573157376 8019509248\n", + "rslt: 8573157376 8023703552\n", + "rslt: 8556380160 8023703552\n", + "rslt: 8556380160 8023703552\n", + "rslt: 8556380160 8027897856\n", + "rslt: 8539602944 8027897856\n", + "rslt: 8539602944 8027897856\n", + "rslt: 8539602944 8027897856\n", + "rslt: 8522825728 8032092160\n", + "rslt: 8522825728 8032092160\n", + "rslt: 8522825728 8032092160\n", + "rslt: 8506048512 8036286464\n", + "rslt: 8506048512 8036286464\n", + "rslt: 8506048512 8036286464\n", + "rslt: 8489271296 8040480768\n", + "rslt: 8489271296 8040480768\n", + "rslt: 8489271296 8040480768\n", + "rslt: 8472494080 8044675072\n", + "rslt: 8472494080 8044675072\n", + "rslt: 8472494080 8044675072\n", + "rslt: 8455716864 8048869376\n", + "rslt: 8455716864 8048869376\n", + "rslt: 8455716864 8048869376\n", + "rslt: 8438939648 8053063680\n", + "rslt: 8438939648 8053063680\n", + "rslt: 8438939648 8053063680\n", + "rslt: 8422162432 8057257984\n", + "rslt: 8422162432 8057257984\n", + "rslt: 8422162432 8057257984\n", + "rslt: 8405385216 8057257984\n", + "rslt: 8405385216 8061452288\n", + "rslt: 8405385216 8061452288\n", + "rslt: 8388608000 8061452288\n", + "rslt: 8388608000 8065646592\n", + "rslt: 8388608000 8065646592\n", + "rslt: 8371830784 8065646592\n", + "rslt: 8371830784 8069840896\n", + "rslt: 8371830784 8069840896\n", + "rslt: 8355053568 8069840896\n", + "rslt: 8355053568 8074035200\n", + "rslt: 8355053568 8074035200\n", + "rslt: 8338276352 8074035200\n", + "rslt: 8338276352 8078229504\n", + "rslt: 8338276352 8078229504\n", + "rslt: 8321499136 8078229504\n", + "rslt: 8321499136 8082423808\n", + "rslt: 8321499136 8082423808\n", + "rslt: 8304721920 8082423808\n", + "rslt: 8304721920 8086618112\n", + "rslt: 8304721920 8086618112\n", + "rslt: 8287944704 8086618112\n", + "rslt: 8287944704 8086618112\n", + "rslt: 8287944704 8090812416\n", + "rslt: 8287944704 8090812416\n", + "rslt: 8271167488 8090812416\n", + "rslt: 8271167488 8095006720\n", + "rslt: 8271167488 8095006720\n", + "rslt: 8254390272 8095006720\n", + "rslt: 8254390272 8099201024\n", + "rslt: 8254390272 8099201024\n", + "rslt: 8237613056 8099201024\n", + "rslt: 8237613056 8103395328\n", + "rslt: 8237613056 8103395328\n", + "rslt: 8220835840 8103395328\n", + "rslt: 8220835840 8107589632\n", + "rslt: 8220835840 8107589632\n", + "rslt: 8204058624 8107589632\n", + "rslt: 8204058624 8111783936\n", + "rslt: 8204058624 8111783936\n", + "rslt: 8187281408 8111783936\n", + "rslt: 8187281408 8115978240\n", + "rslt: 8187281408 8115978240\n", + "rslt: 8170504192 8115978240\n", + "rslt: 8170504192 8115978240\n", + "rslt: 8170504192 8120172544\n", + "rslt: 8153726976 8120172544\n", + "rslt: 8153726976 8120172544\n", + "rslt: 8153726976 8124366848\n", + "rslt: 8136949760 8124366848\n", + "rslt: 8136949760 8124366848\n", + "rslt: 8136949760 8128561152\n", + "rslt: 8120172544 8128561152\n", + "rslt: 8120172544 8128561152\n", + "rslt: 8120172544 8132755456\n", + "rslt: 8103395328 8132755456\n", + "rslt: 8103395328 8132755456\n", + "rslt: 8103395328 8136949760\n", + "rslt: 8086618112 8136949760\n", + "rslt: 8086618112 8136949760\n", + "rslt: 8086618112 8141144064\n", + "rslt: 8069840896 8141144064\n", + "rslt: 8069840896 8141144064\n", + "rslt: 8069840896 8145338368\n", + "rslt: 8053063680 8145338368\n", + "rslt: 8053063680 8145338368\n", + "rslt: 8053063680 8145338368\n", + "rslt: 8036286464 8149532672\n", + "rslt: 8036286464 8149532672\n", + "rslt: 8036286464 8149532672\n", + "rslt: 8019509248 8153726976\n", + "rslt: 8019509248 8153726976\n", + "rslt: 8019509248 8153726976\n", + "rslt: 8002732032 8157921280\n", + "rslt: 8002732032 8157921280\n", + "rslt: 8002732032 8157921280\n", + "rslt: 7985954816 8162115584\n", + "rslt: 7985954816 8162115584\n", + "rslt: 7985954816 8162115584\n", + "rslt: 7969177600 8166309888\n", + "rslt: 7969177600 8166309888\n", + "rslt: 7969177600 8166309888\n", + "rslt: 7952400384 8170504192\n", + "rslt: 7952400384 8170504192\n", + "rslt: 7952400384 8170504192\n", + "rslt: 7935623168 8170504192\n", + "rslt: 7935623168 8174698496\n", + "rslt: 7935623168 8174698496\n", + "rslt: 7918845952 8174698496\n", + "rslt: 7918845952 8178892800\n", + "rslt: 7918845952 8178892800\n", + "rslt: 7902068736 8178892800\n", + "rslt: 7902068736 8183087104\n", + "rslt: 7902068736 8183087104\n", + "rslt: 7885291520 8183087104\n", + "rslt: 7885291520 8187281408\n", + "rslt: 7885291520 8187281408\n", + "rslt: 7868514304 8187281408\n", + "rslt: 7868514304 8191475712\n", + "rslt: 7868514304 8191475712\n", + "rslt: 7851737088 8191475712\n", + "rslt: 7851737088 8195670016\n", + "rslt: 7851737088 8195670016\n", + "rslt: 7834959872 8195670016\n", + "rslt: 7834959872 8199864320\n", + "rslt: 7834959872 8199864320\n", + "rslt: 7818182656 8199864320\n", + "rslt: 7818182656 8199864320\n", + "rslt: 7818182656 8204058624\n", + "rslt: 7801405440 8204058624\n", + "rslt: 7801405440 8204058624\n", + "rslt: 7801405440 8208252928\n", + "rslt: 7784628224 8208252928\n", + "rslt: 7784628224 8208252928\n", + "rslt: 7784628224 8212447232\n", + "rslt: 7767851008 8212447232\n", + "rslt: 7767851008 8212447232\n", + "rslt: 7767851008 8216641536\n", + "rslt: 7751073792 8216641536\n", + "rslt: 7751073792 8216641536\n", + "rslt: 7751073792 8220835840\n", + "rslt: 7734296576 8220835840\n", + "rslt: 7734296576 8220835840\n", + "rslt: 7734296576 8225030144\n", + "rslt: 7717519360 8225030144\n", + "rslt: 7717519360 8225030144\n", + "rslt: 7717519360 8229224448\n", + "rslt: 7700742144 8229224448\n", + "rslt: 7700742144 8229224448\n", + "rslt: 7700742144 8229224448\n", + "rslt: 7683964928 8233418752\n", + "rslt: 7683964928 8233418752\n", + "rslt: 7683964928 8233418752\n", + "rslt: 7667187712 8237613056\n", + "rslt: 7667187712 8237613056\n", + "rslt: 7667187712 8237613056\n", + "rslt: 7650410496 8241807360\n", + "rslt: 7650410496 8241807360\n", + "rslt: 7650410496 8241807360\n", + "rslt: 7633633280 8246001664\n", + "rslt: 7633633280 8246001664\n", + "rslt: 7633633280 8246001664\n", + "rslt: 7616856064 8250195968\n", + "rslt: 7616856064 8250195968\n", + "rslt: 7616856064 8250195968\n", + "rslt: 7600078848 8254390272\n", + "rslt: 7600078848 8254390272\n", + "rslt: 7600078848 8254390272\n", + "rslt: 7583301632 8258584576\n", + "rslt: 7583301632 8258584576\n", + "rslt: 7583301632 8258584576\n", + "rslt: 7566524416 8258584576\n", + "rslt: 7566524416 8262778880\n", + "rslt: 7566524416 8262778880\n", + "rslt: 7549747200 8262778880\n", + "rslt: 7549747200 8266973184\n", + "rslt: 7549747200 8266973184\n", + "rslt: 7532969984 8266973184\n", + "rslt: 7532969984 8271167488\n", + "rslt: 7532969984 8271167488\n", + "rslt: 7516192768 8271167488\n", + "rslt: 7516192768 8275361792\n", + "rslt: 7516192768 8275361792\n", + "rslt: 7499415552 8275361792\n", + "rslt: 7499415552 8279556096\n", + "rslt: 7499415552 8279556096\n", + "rslt: 7482638336 8279556096\n", + "rslt: 7482638336 8283750400\n", + "rslt: 7482638336 8283750400\n", + "rslt: 7465861120 8283750400\n", + "rslt: 7465861120 8287944704\n", + "rslt: 7465861120 8287944704\n", + "rslt: 7449083904 8287944704\n", + "rslt: 7449083904 8287944704\n", + "rslt: 7449083904 8292139008\n", + "rslt: 7432306688 8292139008\n", + "rslt: 7432306688 8292139008\n", + "rslt: 7432306688 8296333312\n", + "rslt: 7415529472 8296333312\n", + "rslt: 7415529472 8296333312\n", + "rslt: 7415529472 8300527616\n", + "rslt: 7398752256 8300527616\n", + "rslt: 7398752256 8300527616\n", + "rslt: 7398752256 8304721920\n", + "rslt: 7381975040 8304721920\n", + "rslt: 7381975040 8304721920\n", + "rslt: 7381975040 8308916224\n", + "rslt: 7365197824 8308916224\n", + "rslt: 7365197824 8308916224\n", + "rslt: 7365197824 8313110528\n", + "rslt: 7348420608 8313110528\n", + "rslt: 7348420608 8313110528\n", + "rslt: 7348420608 8317304832\n", + "rslt: 7331643392 8317304832\n", + "rslt: 7331643392 8317304832\n", + "rslt: 7331643392 8317304832\n", + "rslt: 7314866176 8321499136\n", + "rslt: 7314866176 8321499136\n", + "rslt: 7314866176 8321499136\n", + "rslt: 7298088960 8325693440\n", + "rslt: 7298088960 8325693440\n", + "rslt: 7298088960 8325693440\n", + "rslt: 7281311744 8329887744\n", + "rslt: 7281311744 8329887744\n", + "rslt: 7281311744 8329887744\n", + "rslt: 7264534528 8334082048\n", + "rslt: 7264534528 8334082048\n", + "rslt: 7264534528 8334082048\n", + "rslt: 7247757312 8338276352\n", + "rslt: 7247757312 8338276352\n", + "rslt: 7247757312 8338276352\n", + "rslt: 7230980096 8342470656\n", + "rslt: 7230980096 8342470656\n", + "rslt: 7230980096 8342470656\n", + "rslt: 7214202880 8346664960\n", + "rslt: 7214202880 8346664960\n", + "rslt: 7214202880 8346664960\n", + "rslt: 7197425664 8346664960\n", + "rslt: 7197425664 8350859264\n", + "rslt: 7197425664 8350859264\n", + "rslt: 7180648448 8350859264\n", + "rslt: 7180648448 8355053568\n", + "rslt: 7180648448 8355053568\n", + "rslt: 7163871232 8355053568\n", + "rslt: 7163871232 8359247872\n", + "rslt: 7163871232 8359247872\n", + "rslt: 7147094016 8359247872\n", + "rslt: 7147094016 8363442176\n", + "rslt: 7147094016 8363442176\n", + "rslt: 7130316800 8363442176\n", + "rslt: 7130316800 8367636480\n", + "rslt: 7130316800 8367636480\n", + "rslt: 7130316800 8367636480\n", + "rslt: 7113539584 8371830784\n", + "rslt: 7113539584 8371830784\n", + "rslt: 7113539584 8371830784\n", + "rslt: 7096762368 8371830784\n", + "rslt: 7096762368 8376025088\n", + "rslt: 7096762368 8376025088\n", + "rslt: 7079985152 8376025088\n", + "rslt: 7079985152 8380219392\n", + "rslt: 7079985152 8380219392\n", + "rslt: 7063207936 8380219392\n", + "rslt: 7063207936 8384413696\n", + "rslt: 7063207936 8384413696\n", + "rslt: 7046430720 8384413696\n", + "rslt: 7046430720 8388608000\n", + "rslt: 7046430720 8388608000\n", + "rslt: 7029653504 8388608000\n", + "rslt: 7029653504 8392802304\n", + "rslt: 7029653504 8392802304\n", + "rslt: 7012876288 8392802304\n", + "rslt: 7012876288 8396996608\n", + "rslt: 7012876288 8396996608\n", + "rslt: 6996099072 8396996608\n", + "rslt: 6996099072 8401190912\n", + "rslt: 6996099072 8401190912\n", + "rslt: 6979321856 8401190912\n", + "rslt: 6979321856 8401190912\n", + "rslt: 6979321856 8405385216\n", + "rslt: 6962544640 8405385216\n", + "rslt: 6962544640 8405385216\n", + "rslt: 6962544640 8409579520\n", + "rslt: 6945767424 8409579520\n", + "rslt: 6945767424 8409579520\n", + "rslt: 6945767424 8413773824\n", + "rslt: 6928990208 8413773824\n", + "rslt: 6928990208 8413773824\n", + "rslt: 6928990208 8417968128\n", + "rslt: 6912212992 8417968128\n", + "rslt: 6912212992 8417968128\n", + "rslt: 6912212992 8422162432\n", + "rslt: 6895435776 8422162432\n", + "rslt: 6895435776 8422162432\n", + "rslt: 6895435776 8426356736\n", + "rslt: 6878658560 8426356736\n", + "rslt: 6878658560 8426356736\n", + "rslt: 6878658560 8430551040\n", + "rslt: 6861881344 8430551040\n", + "rslt: 6861881344 8430551040\n", + "rslt: 6861881344 8430551040\n", + "rslt: 6845104128 8434745344\n", + "rslt: 6845104128 8434745344\n", + "rslt: 6845104128 8434745344\n", + "rslt: 6828326912 8438939648\n", + "rslt: 6828326912 8438939648\n", + "rslt: 6828326912 8438939648\n", + "rslt: 6811549696 8443133952\n", + "rslt: 6811549696 8443133952\n", + "rslt: 6811549696 8443133952\n", + "rslt: 6794772480 8447328256\n", + "rslt: 6794772480 8447328256\n", + "rslt: 6794772480 8447328256\n", + "rslt: 6777995264 8451522560\n", + "rslt: 6777995264 8451522560\n", + "rslt: 6777995264 8451522560\n", + "rslt: 6761218048 8455716864\n", + "rslt: 6761218048 8455716864\n", + "rslt: 6761218048 8455716864\n", + "rslt: 6744440832 8459911168\n", + "rslt: 6744440832 8459911168\n", + "rslt: 6744440832 8459911168\n", + "rslt: 6727663616 8459911168\n", + "rslt: 6727663616 8464105472\n", + "rslt: 6727663616 8464105472\n", + "rslt: 6710886400 8464105472\n", + "rslt: 6710886400 8468299776\n", + "rslt: 6710886400 8468299776\n", + "rslt: 6694109184 8468299776\n", + "rslt: 6694109184 8472494080\n", + "rslt: 6694109184 8472494080\n", + "rslt: 6677331968 8472494080\n", + "rslt: 6677331968 8476688384\n", + "rslt: 6677331968 8476688384\n", + "rslt: 6660554752 8476688384\n", + "rslt: 6660554752 8480882688\n", + "rslt: 6660554752 8480882688\n", + "rslt: 6643777536 8480882688\n", + "rslt: 6643777536 8485076992\n", + "rslt: 6643777536 8485076992\n", + "rslt: 6627000320 8485076992\n", + "rslt: 6627000320 8489271296\n", + "rslt: 6627000320 8489271296\n", + "rslt: 6610223104 8489271296\n", + "rslt: 6610223104 8489271296\n", + "rslt: 6610223104 8493465600\n", + "rslt: 6593445888 8493465600\n", + "rslt: 6593445888 8493465600\n", + "rslt: 6593445888 8497659904\n", + "rslt: 6576668672 8497659904\n", + "rslt: 6576668672 8497659904\n", + "rslt: 6576668672 8501854208\n", + "rslt: 6559891456 8501854208\n", + "rslt: 6559891456 8501854208\n", + "rslt: 6559891456 8506048512\n", + "rslt: 6543114240 8506048512\n", + "rslt: 6543114240 8506048512\n", + "rslt: 6543114240 8510242816\n", + "rslt: 6526337024 8510242816\n", + "rslt: 6526337024 8510242816\n", + "rslt: 6526337024 8514437120\n", + "rslt: 6509559808 8514437120\n", + "rslt: 6509559808 8514437120\n", + "rslt: 6509559808 8518631424\n", + "rslt: 6492782592 8518631424\n", + "rslt: 6492782592 8518631424\n", + "rslt: 6492782592 8518631424\n", + "rslt: 6476005376 8522825728\n", + "rslt: 6476005376 8522825728\n", + "rslt: 6476005376 8522825728\n", + "rslt: 6459228160 8527020032\n", + "rslt: 6459228160 8527020032\n", + "rslt: 6459228160 8527020032\n", + "rslt: 6442450944 8531214336\n", + "rslt: 6442450944 8531214336\n", + "rslt: 6442450944 8531214336\n", + "rslt: 6425673728 8535408640\n", + "rslt: 6425673728 8535408640\n", + "rslt: 6425673728 8535408640\n", + "rslt: 6408896512 8539602944\n", + "rslt: 6408896512 8539602944\n", + "rslt: 6408896512 8539602944\n", + "rslt: 6392119296 8543797248\n", + "rslt: 6392119296 8543797248\n", + "rslt: 6392119296 8543797248\n", + "rslt: 6375342080 8547991552\n", + "rslt: 6375342080 8547991552\n", + "rslt: 6375342080 8547991552\n", + "rslt: 6358564864 8547991552\n", + "rslt: 6358564864 8552185856\n", + "rslt: 6358564864 8552185856\n", + "rslt: 6341787648 8552185856\n", + "rslt: 6341787648 8556380160\n", + "rslt: 6341787648 8556380160\n", + "rslt: 6325010432 8556380160\n", + "rslt: 6325010432 8560574464\n", + "rslt: 6325010432 8560574464\n", + "rslt: 6308233216 8560574464\n", + "rslt: 6308233216 8564768768\n", + "rslt: 6308233216 8564768768\n", + "rslt: 6291456000 8564768768\n", + "rslt: 6291456000 8568963072\n", + "rslt: 6291456000 8568963072\n", + "rslt: 6274678784 8568963072\n", + "rslt: 6274678784 8573157376\n", + "rslt: 6274678784 8573157376\n", + "rslt: 6257901568 8573157376\n", + "rslt: 6257901568 8573157376\n", + "rslt: 6257901568 8577351680\n", + "rslt: 6241124352 8577351680\n", + "rslt: 6241124352 8577351680\n", + "rslt: 6241124352 8581545984\n", + "rslt: 6224347136 8581545984\n", + "rslt: 6224347136 8581545984\n", + "rslt: 6224347136 8585740288\n", + "rslt: 6207569920 8585740288\n", + "rslt: 6207569920 8585740288\n", + "rslt: 6207569920 8589934592\n", + "rslt: 6190792704 8589934592\n", + "rslt: 6190792704 8589934592\n", + "rslt: 6190792704 8594128896\n", + "rslt: 6174015488 8594128896\n", + "rslt: 6174015488 8594128896\n", + "rslt: 6174015488 8598323200\n", + "rslt: 6157238272 8598323200\n", + "rslt: 6157238272 8598323200\n", + "rslt: 6157238272 8602517504\n", + "rslt: 6140461056 8602517504\n", + "rslt: 6140461056 8602517504\n", + "rslt: 6140461056 8602517504\n", + "rslt: 6123683840 8606711808\n", + "rslt: 6123683840 8606711808\n", + "rslt: 6123683840 8606711808\n", + "rslt: 6106906624 8610906112\n", + "rslt: 6106906624 8610906112\n", + "rslt: 6106906624 8610906112\n", + "rslt: 6090129408 8615100416\n", + "rslt: 6090129408 8615100416\n", + "rslt: 6090129408 8615100416\n", + "rslt: 6073352192 8619294720\n", + "rslt: 6073352192 8619294720\n", + "rslt: 6073352192 8619294720\n", + "rslt: 6056574976 8623489024\n", + "rslt: 6056574976 8623489024\n", + "rslt: 6056574976 8623489024\n", + "rslt: 6039797760 8627683328\n", + "rslt: 6039797760 8627683328\n", + "rslt: 6039797760 8627683328\n", + "rslt: 6023020544 8631877632\n", + "rslt: 6023020544 8631877632\n", + "rslt: 6023020544 8631877632\n", + "rslt: 6006243328 8631877632\n", + "rslt: 6006243328 8636071936\n", + "rslt: 6006243328 8636071936\n", + "rslt: 5989466112 8636071936\n", + "rslt: 5989466112 8640266240\n", + "rslt: 5989466112 8640266240\n", + "rslt: 5972688896 8640266240\n", + "rslt: 5972688896 8644460544\n", + "rslt: 5972688896 8644460544\n", + "rslt: 5972688896 8644460544\n", + "rslt: 5955911680 8648654848\n", + "rslt: 5955911680 8648654848\n", + "rslt: 5955911680 8648654848\n", + "rslt: 5939134464 8652849152\n", + "rslt: 5939134464 8652849152\n", + "rslt: 5939134464 8652849152\n", + "rslt: 5922357248 8657043456\n", + "rslt: 5922357248 8657043456\n", + "rslt: 5922357248 8657043456\n", + "rslt: 5905580032 8661237760\n", + "rslt: 5905580032 8661237760\n", + "rslt: 5905580032 8661237760\n", + "rslt: 5888802816 8661237760\n", + "rslt: 5888802816 8665432064\n", + "rslt: 5888802816 8665432064\n", + "rslt: 5872025600 8665432064\n", + "rslt: 5872025600 8669626368\n", + "rslt: 5872025600 8669626368\n", + "rslt: 5855248384 8669626368\n", + "rslt: 5855248384 8673820672\n", + "rslt: 5855248384 8673820672\n", + "rslt: 5838471168 8673820672\n", + "rslt: 5838471168 8678014976\n", + "rslt: 5838471168 8678014976\n", + "rslt: 5821693952 8678014976\n", + "rslt: 5821693952 8682209280\n", + "rslt: 5821693952 8682209280\n", + "rslt: 5804916736 8682209280\n", + "rslt: 5804916736 8686403584\n", + "rslt: 5804916736 8686403584\n", + "rslt: 5788139520 8686403584\n", + "rslt: 5788139520 8690597888\n", + "rslt: 5788139520 8690597888\n", + "rslt: 5771362304 8690597888\n", + "rslt: 5771362304 8690597888\n", + "rslt: 5771362304 8694792192\n", + "rslt: 5754585088 8694792192\n", + "rslt: 5754585088 8694792192\n", + "rslt: 5754585088 8698986496\n", + "rslt: 5737807872 8698986496\n", + "rslt: 5737807872 8698986496\n", + "rslt: 5737807872 8703180800\n", + "rslt: 5721030656 8703180800\n", + "rslt: 5721030656 8703180800\n", + "rslt: 5721030656 8707375104\n", + "rslt: 5704253440 8707375104\n", + "rslt: 5704253440 8707375104\n", + "rslt: 5704253440 8711569408\n", + "rslt: 5687476224 8711569408\n", + "rslt: 5687476224 8711569408\n", + "rslt: 5687476224 8715763712\n", + "rslt: 5670699008 8715763712\n", + "rslt: 5670699008 8715763712\n", + "rslt: 5670699008 8719958016\n", + "rslt: 5653921792 8719958016\n", + "rslt: 5653921792 8719958016\n", + "rslt: 5653921792 8719958016\n", + "rslt: 5637144576 8724152320\n", + "rslt: 5637144576 8724152320\n", + "rslt: 5637144576 8724152320\n", + "rslt: 5620367360 8728346624\n", + "rslt: 5620367360 8728346624\n", + "rslt: 5620367360 8728346624\n", + "rslt: 5603590144 8732540928\n", + "rslt: 5603590144 8732540928\n", + "rslt: 5603590144 8732540928\n", + "rslt: 5586812928 8736735232\n", + "rslt: 5586812928 8736735232\n", + "rslt: 5586812928 8736735232\n", + "rslt: 5570035712 8740929536\n", + "rslt: 5570035712 8740929536\n", + "rslt: 5570035712 8740929536\n", + "rslt: 5553258496 8745123840\n", + "rslt: 5553258496 8745123840\n", + "rslt: 5553258496 8745123840\n", + "rslt: 5536481280 8749318144\n", + "rslt: 5536481280 8749318144\n", + "rslt: 5536481280 8749318144\n", + "rslt: 5519704064 8749318144\n", + "rslt: 5519704064 8753512448\n", + "rslt: 5519704064 8753512448\n", + "rslt: 5502926848 8753512448\n", + "rslt: 5502926848 8757706752\n", + "rslt: 5502926848 8757706752\n", + "rslt: 5486149632 8757706752\n", + "rslt: 5486149632 8761901056\n", + "rslt: 5486149632 8761901056\n", + "rslt: 5469372416 8761901056\n", + "rslt: 5469372416 8766095360\n", + "rslt: 5469372416 8766095360\n", + "rslt: 5452595200 8766095360\n", + "rslt: 5452595200 8770289664\n", + "rslt: 5452595200 8770289664\n", + "rslt: 5435817984 8770289664\n", + "rslt: 5435817984 8774483968\n", + "rslt: 5435817984 8774483968\n", + "rslt: 5419040768 8774483968\n", + "rslt: 5419040768 8774483968\n", + "rslt: 5419040768 8778678272\n", + "rslt: 5402263552 8778678272\n", + "rslt: 5402263552 8778678272\n", + "rslt: 5402263552 8782872576\n", + "rslt: 5385486336 8782872576\n", + "rslt: 5385486336 8782872576\n", + "rslt: 5385486336 8787066880\n", + "rslt: 5368709120 8787066880\n", + "rslt: 5368709120 8787066880\n", + "rslt: 5368709120 8791261184\n", + "rslt: 5351931904 8791261184\n", + "rslt: 5351931904 8791261184\n", + "rslt: 5351931904 8795455488\n", + "rslt: 5335154688 8795455488\n", + "rslt: 5335154688 8795455488\n", + "rslt: 5335154688 8799649792\n", + "rslt: 5318377472 8799649792\n", + "rslt: 5318377472 8799649792\n", + "rslt: 5318377472 8803844096\n", + "rslt: 5301600256 8803844096\n", + "rslt: 5301600256 8803844096\n", + "rslt: 5301600256 8803844096\n", + "rslt: 5284823040 8808038400\n", + "rslt: 5284823040 8808038400\n", + "rslt: 5284823040 8808038400\n", + "rslt: 5268045824 8812232704\n", + "rslt: 5268045824 8812232704\n", + "rslt: 5268045824 8812232704\n", + "rslt: 5251268608 8816427008\n", + "rslt: 5251268608 8816427008\n", + "rslt: 5251268608 8816427008\n", + "rslt: 5234491392 8820621312\n", + "rslt: 5234491392 8820621312\n", + "rslt: 5234491392 8820621312\n", + "rslt: 5217714176 8824815616\n", + "rslt: 5217714176 8824815616\n", + "rslt: 5217714176 8824815616\n", + "rslt: 5200936960 8829009920\n", + "rslt: 5200936960 8829009920\n", + "rslt: 5200936960 8829009920\n", + "rslt: 5184159744 8833204224\n", + "rslt: 5184159744 8833204224\n", + "rslt: 5184159744 8833204224\n", + "rslt: 5167382528 8833204224\n", + "rslt: 5167382528 8837398528\n", + "rslt: 5167382528 8837398528\n", + "rslt: 5150605312 8837398528\n", + "rslt: 5150605312 8841592832\n", + "rslt: 5150605312 8841592832\n", + "rslt: 5133828096 8841592832\n", + "rslt: 5133828096 8845787136\n", + "rslt: 5133828096 8845787136\n", + "rslt: 5117050880 8845787136\n", + "rslt: 5117050880 8849981440\n", + "rslt: 5117050880 8849981440\n", + "rslt: 5100273664 8849981440\n", + "rslt: 5100273664 8854175744\n", + "rslt: 5100273664 8854175744\n", + "rslt: 5083496448 8854175744\n", + "rslt: 5083496448 8858370048\n", + "rslt: 5083496448 8858370048\n", + "rslt: 5066719232 8858370048\n", + "rslt: 5066719232 8862564352\n", + "rslt: 5066719232 8862564352\n", + "rslt: 5049942016 8862564352\n", + "rslt: 5049942016 8862564352\n", + "rslt: 5049942016 8866758656\n", + "rslt: 5033164800 8866758656\n", + "rslt: 5033164800 8866758656\n", + "rslt: 5033164800 8870952960\n", + "rslt: 5016387584 8870952960\n", + "rslt: 5016387584 8870952960\n", + "rslt: 5016387584 8875147264\n", + "rslt: 4999610368 8875147264\n", + "rslt: 4999610368 8875147264\n", + "rslt: 4999610368 8879341568\n", + "rslt: 4982833152 8879341568\n", + "rslt: 4982833152 8879341568\n", + "rslt: 4982833152 8883535872\n", + "rslt: 4966055936 8883535872\n", + "rslt: 4966055936 8883535872\n", + "rslt: 4966055936 8887730176\n", + "rslt: 4949278720 8887730176\n", + "rslt: 4949278720 8887730176\n", + "rslt: 4949278720 8891924480\n", + "rslt: 4932501504 8891924480\n", + "rslt: 4932501504 8891924480\n", + "rslt: 4932501504 8891924480\n", + "rslt: 4915724288 8896118784\n", + "rslt: 4915724288 8896118784\n", + "rslt: 4915724288 8896118784\n", + "rslt: 4898947072 8900313088\n", + "rslt: 4898947072 8900313088\n", + "rslt: 4898947072 8900313088\n", + "rslt: 4882169856 8904507392\n", + "rslt: 4882169856 8904507392\n", + "rslt: 4882169856 8904507392\n", + "rslt: 4865392640 8908701696\n", + "rslt: 4865392640 8908701696\n", + "rslt: 4865392640 8908701696\n", + "rslt: 4848615424 8912896000\n", + "rslt: 4848615424 8912896000\n", + "rslt: 4848615424 8912896000\n", + "rslt: 4831838208 8917090304\n", + "rslt: 4831838208 8917090304\n", + "rslt: 4831838208 8917090304\n", + "rslt: 4815060992 8921284608\n", + "rslt: 4815060992 8921284608\n", + "rslt: 4815060992 8921284608\n", + "rslt: 4798283776 8921284608\n", + "rslt: 4798283776 8925478912\n", + "rslt: 4798283776 8925478912\n", + "rslt: 4798283776 8925478912\n", + "rslt: 4781506560 8929673216\n", + "rslt: 4781506560 8929673216\n", + "rslt: 4781506560 8929673216\n", + "rslt: 4764729344 8933867520\n", + "rslt: 4764729344 8933867520\n", + "rslt: 4764729344 8933867520\n", + "rslt: 4747952128 8938061824\n", + "rslt: 4747952128 8938061824\n", + "rslt: 4747952128 8938061824\n", + "rslt: 4731174912 8942256128\n", + "rslt: 4731174912 8942256128\n", + "rslt: 4731174912 8942256128\n", + "rslt: 4714397696 8946450432\n", + "rslt: 4714397696 8946450432\n", + "rslt: 4714397696 8946450432\n", + "rslt: 4697620480 8950644736\n", + "rslt: 4697620480 8950644736\n", + "rslt: 4697620480 8950644736\n", + "rslt: 4680843264 8950644736\n", + "rslt: 4680843264 8954839040\n", + "rslt: 4680843264 8954839040\n", + "rslt: 4664066048 8954839040\n", + "rslt: 4664066048 8959033344\n", + "rslt: 4664066048 8959033344\n", + "rslt: 4647288832 8959033344\n", + "rslt: 4647288832 8963227648\n", + "rslt: 4647288832 8963227648\n", + "rslt: 4630511616 8963227648\n", + "rslt: 4630511616 8967421952\n", + "rslt: 4630511616 8967421952\n", + "rslt: 4613734400 8967421952\n", + "rslt: 4613734400 8971616256\n", + "rslt: 4613734400 8971616256\n", + "rslt: 4596957184 8971616256\n", + "rslt: 4596957184 8975810560\n", + "rslt: 4596957184 8975810560\n", + "rslt: 4580179968 8975810560\n", + "rslt: 4580179968 8975810560\n", + "rslt: 4580179968 8980004864\n", + "rslt: 4563402752 8980004864\n", + "rslt: 4563402752 8980004864\n", + "rslt: 4563402752 8984199168\n", + "rslt: 4546625536 8984199168\n", + "rslt: 4546625536 8984199168\n", + "rslt: 4546625536 8988393472\n", + "rslt: 4529848320 8988393472\n", + "rslt: 4529848320 8988393472\n", + "rslt: 4529848320 8992587776\n", + "rslt: 4513071104 8992587776\n", + "rslt: 4513071104 8992587776\n", + "rslt: 4513071104 8996782080\n", + "rslt: 4496293888 8996782080\n", + "rslt: 4496293888 8996782080\n", + "rslt: 4496293888 9000976384\n", + "rslt: 4479516672 9000976384\n", + "rslt: 4479516672 9000976384\n", + "rslt: 4479516672 9005170688\n", + "rslt: 4462739456 9005170688\n", + "rslt: 4462739456 9005170688\n", + "rslt: 4462739456 9005170688\n", + "rslt: 4445962240 9009364992\n", + "rslt: 4445962240 9009364992\n", + "rslt: 4445962240 9009364992\n", + "rslt: 4429185024 9013559296\n", + "rslt: 4429185024 9013559296\n", + "rslt: 4429185024 9013559296\n", + "rslt: 4412407808 9017753600\n", + "rslt: 4412407808 9017753600\n", + "rslt: 4412407808 9017753600\n", + "rslt: 4395630592 9021947904\n", + "rslt: 4395630592 9021947904\n", + "rslt: 4395630592 9021947904\n", + "rslt: 4378853376 9026142208\n", + "rslt: 4378853376 9026142208\n", + "rslt: 4378853376 9026142208\n", + "rslt: 4362076160 9030336512\n", + "rslt: 4362076160 9030336512\n", + "rslt: 4362076160 9030336512\n", + "rslt: 4345298944 9034530816\n", + "rslt: 4345298944 9034530816\n", + "rslt: 4345298944 9034530816\n", + "rslt: 4328521728 9034530816\n", + "rslt: 4328521728 9038725120\n", + "rslt: 4328521728 9038725120\n", + "rslt: 4311744512 9038725120\n", + "rslt: 4311744512 9042919424\n", + "rslt: 4311744512 9042919424\n", + "rslt: 4294967296 9042919424\n", + "rslt: 4294967296 9047113728\n", + "rslt: 4294967296 9047113728\n", + "rslt: 4278190080 9047113728\n", + "rslt: 4278190080 9051308032\n", + "rslt: 4278190080 9051308032\n", + "rslt: 4261412864 9051308032\n", + "rslt: 4261412864 9055502336\n", + "rslt: 4261412864 9055502336\n", + "rslt: 4244635648 9055502336\n", + "rslt: 4244635648 9059696640\n", + "rslt: 4244635648 9059696640\n", + "rslt: 4227858432 9059696640\n", + "rslt: 4227858432 9063890944\n", + "rslt: 4227858432 9063890944\n", + "rslt: 4211081216 9063890944\n", + "rslt: 4211081216 9063890944\n", + "rslt: 4211081216 9068085248\n", + "rslt: 4194304000 9068085248\n", + "rslt: 4194304000 9068085248\n", + "rslt: 4194304000 9072279552\n", + "rslt: 4177526784 9072279552\n", + "rslt: 4177526784 9072279552\n", + "rslt: 4177526784 9076473856\n", + "rslt: 4160749568 9076473856\n", + "rslt: 4160749568 9076473856\n", + "rslt: 4160749568 9080668160\n", + "rslt: 4143972352 9080668160\n", + "rslt: 4143972352 9080668160\n", + "rslt: 4143972352 9084862464\n", + "rslt: 4127195136 9084862464\n", + "rslt: 4127195136 9084862464\n", + "rslt: 4127195136 9089056768\n", + "rslt: 4110417920 9089056768\n", + "rslt: 4110417920 9089056768\n", + "rslt: 4110417920 9093251072\n", + "rslt: 4093640704 9093251072\n", + "rslt: 4093640704 9093251072\n", + "rslt: 4093640704 9093251072\n", + "rslt: 4076863488 9097445376\n", + "rslt: 4076863488 9097445376\n", + "rslt: 4076863488 9097445376\n", + "rslt: 4060086272 9101639680\n", + "rslt: 4060086272 9101639680\n", + "rslt: 4060086272 9101639680\n", + "rslt: 4043309056 9105833984\n", + "rslt: 4043309056 9105833984\n", + "rslt: 4043309056 9105833984\n", + "rslt: 4026531840 9110028288\n", + "rslt: 4026531840 9110028288\n", + "rslt: 4026531840 9110028288\n", + "rslt: 4009754624 9114222592\n", + "rslt: 4009754624 9114222592\n", + "rslt: 4009754624 9114222592\n", + "rslt: 3992977408 9118416896\n", + "rslt: 3992977408 9118416896\n", + "rslt: 3992977408 9118416896\n", + "rslt: 3976200192 9122611200\n", + "rslt: 3976200192 9122611200\n", + "rslt: 3976200192 9122611200\n", + "rslt: 3959422976 9122611200\n", + "rslt: 3959422976 9126805504\n", + "rslt: 3959422976 9126805504\n", + "rslt: 3942645760 9126805504\n", + "rslt: 3942645760 9130999808\n", + "rslt: 3942645760 9130999808\n", + "rslt: 3925868544 9130999808\n", + "rslt: 3925868544 9135194112\n", + "rslt: 3925868544 9135194112\n", + "rslt: 3909091328 9135194112\n", + "rslt: 3909091328 9139388416\n", + "rslt: 3909091328 9139388416\n", + "rslt: 3892314112 9139388416\n", + "rslt: 3892314112 9143582720\n", + "rslt: 3892314112 9143582720\n", + "rslt: 3875536896 9143582720\n", + "rslt: 3875536896 9147777024\n", + "rslt: 3875536896 9147777024\n", + "rslt: 3858759680 9147777024\n", + "rslt: 3858759680 9151971328\n", + "rslt: 3858759680 9151971328\n", + "rslt: 3841982464 9151971328\n", + "rslt: 3841982464 9151971328\n", + "rslt: 3841982464 9156165632\n", + "rslt: 3825205248 9156165632\n", + "rslt: 3825205248 9156165632\n", + "rslt: 3825205248 9160359936\n", + "rslt: 3808428032 9160359936\n", + "rslt: 3808428032 9160359936\n", + "rslt: 3808428032 9164554240\n", + "rslt: 3791650816 9164554240\n", + "rslt: 3791650816 9164554240\n", + "rslt: 3791650816 9168748544\n", + "rslt: 3774873600 9168748544\n", + "rslt: 3774873600 9168748544\n", + "rslt: 3774873600 9172942848\n", + "rslt: 3758096384 9172942848\n", + "rslt: 3758096384 9172942848\n", + "rslt: 3758096384 9177137152\n", + "rslt: 3741319168 9177137152\n", + "rslt: 3741319168 9177137152\n", + "rslt: 3741319168 9177137152\n", + "rslt: 3724541952 9181331456\n", + "rslt: 3724541952 9181331456\n", + "rslt: 3724541952 9181331456\n", + "rslt: 3707764736 9185525760\n", + "rslt: 3707764736 9185525760\n", + "rslt: 3707764736 9185525760\n", + "rslt: 3690987520 9189720064\n", + "rslt: 3690987520 9189720064\n", + "rslt: 3690987520 9189720064\n", + "rslt: 3674210304 9193914368\n", + "rslt: 3674210304 9193914368\n", + "rslt: 3674210304 9193914368\n", + "rslt: 3657433088 9198108672\n", + "rslt: 3657433088 9198108672\n", + "rslt: 3657433088 9198108672\n", + "rslt: 3640655872 9202302976\n", + "rslt: 3640655872 9202302976\n", + "rslt: 3640655872 9202302976\n", + "rslt: 3640655872 9206497280\n", + "rslt: 3623878656 9206497280\n", + "rslt: 3623878656 9206497280\n", + "rslt: 3623878656 9206497280\n", + "rslt: 3607101440 9210691584\n", + "rslt: 3607101440 9210691584\n", + "rslt: 3607101440 9210691584\n", + "rslt: 3590324224 9214885888\n", + "rslt: 3590324224 9214885888\n", + "rslt: 3590324224 9214885888\n", + "rslt: 3573547008 9219080192\n", + "rslt: 3573547008 9219080192\n", + "rslt: 3573547008 9219080192\n", + "rslt: 3556769792 9223274496\n", + "rslt: 3556769792 9223274496\n", + "rslt: 3556769792 9223274496\n", + "rslt: 3539992576 9227468800\n", + "rslt: 3539992576 9227468800\n", + "rslt: 3539992576 9227468800\n", + "rslt: 3523215360 9231663104\n", + "rslt: 3523215360 9231663104\n", + "rslt: 3523215360 9231663104\n", + "rslt: 3506438144 9235857408\n", + "rslt: 3506438144 9235857408\n", + "rslt: 3506438144 9235857408\n", + "rslt: 3489660928 9235857408\n", + "rslt: 3489660928 9240051712\n", + "rslt: 3489660928 9240051712\n", + "rslt: 3472883712 9240051712\n", + "rslt: 3472883712 9244246016\n", + "rslt: 3472883712 9244246016\n", + "rslt: 3456106496 9244246016\n", + "rslt: 3456106496 9248440320\n", + "rslt: 3456106496 9248440320\n", + "rslt: 3439329280 9248440320\n", + "rslt: 3439329280 9252634624\n", + "rslt: 3439329280 9252634624\n", + "rslt: 3422552064 9252634624\n", + "rslt: 3422552064 9256828928\n", + "rslt: 3422552064 9256828928\n", + "rslt: 3405774848 9256828928\n", + "rslt: 3405774848 9261023232\n", + "rslt: 3405774848 9261023232\n", + "rslt: 3388997632 9261023232\n", + "rslt: 3388997632 9265217536\n", + "rslt: 3388997632 9265217536\n", + "rslt: 3372220416 9265217536\n", + "rslt: 3372220416 9265217536\n", + "rslt: 3372220416 9269411840\n", + "rslt: 3355443200 9269411840\n", + "rslt: 3355443200 9269411840\n", + "rslt: 3355443200 9273606144\n", + "rslt: 3338665984 9273606144\n", + "rslt: 3338665984 9273606144\n", + "rslt: 3338665984 9277800448\n", + "rslt: 3321888768 9277800448\n", + "rslt: 3321888768 9277800448\n", + "rslt: 3321888768 9281994752\n", + "rslt: 3305111552 9281994752\n", + "rslt: 3305111552 9281994752\n", + "rslt: 3305111552 9286189056\n", + "rslt: 3288334336 9286189056\n", + "rslt: 3288334336 9286189056\n", + "rslt: 3288334336 9290383360\n", + "rslt: 3271557120 9290383360\n", + "rslt: 3271557120 9290383360\n", + "rslt: 3271557120 9294577664\n", + "rslt: 3254779904 9294577664\n", + "rslt: 3254779904 9294577664\n", + "rslt: 3254779904 9294577664\n", + "rslt: 3238002688 9298771968\n", + "rslt: 3238002688 9298771968\n", + "rslt: 3238002688 9298771968\n", + "rslt: 3221225472 9302966272\n", + "rslt: 3221225472 9302966272\n", + "rslt: 3221225472 9302966272\n", + "rslt: 3204448256 9307160576\n", + "rslt: 3204448256 9307160576\n", + "rslt: 3204448256 9307160576\n", + "rslt: 3187671040 9311354880\n", + "rslt: 3187671040 9311354880\n", + "rslt: 3187671040 9311354880\n", + "rslt: 3170893824 9315549184\n", + "rslt: 3170893824 9315549184\n", + "rslt: 3170893824 9315549184\n", + "rslt: 3154116608 9319743488\n", + "rslt: 3154116608 9319743488\n", + "rslt: 3154116608 9319743488\n", + "rslt: 3137339392 9323937792\n", + "rslt: 3137339392 9323937792\n", + "rslt: 3137339392 9323937792\n", + "rslt: 3120562176 9323937792\n", + "rslt: 3120562176 9328132096\n", + "rslt: 3120562176 9328132096\n", + "rslt: 3103784960 9328132096\n", + "rslt: 3103784960 9332326400\n", + "rslt: 3103784960 9332326400\n", + "rslt: 3087007744 9332326400\n", + "rslt: 3087007744 9336520704\n", + "rslt: 3087007744 9336520704\n", + "rslt: 3070230528 9336520704\n", + "rslt: 3070230528 9340715008\n", + "rslt: 3070230528 9340715008\n", + "rslt: 3053453312 9340715008\n", + "rslt: 3053453312 9344909312\n", + "rslt: 3053453312 9344909312\n", + "rslt: 3036676096 9344909312\n", + "rslt: 3036676096 9349103616\n", + "rslt: 3036676096 9349103616\n", + "rslt: 3019898880 9349103616\n", + "rslt: 3019898880 9353297920\n", + "rslt: 3019898880 9353297920\n", + "rslt: 3003121664 9353297920\n", + "rslt: 3003121664 9353297920\n", + "rslt: 3003121664 9357492224\n", + "rslt: 2986344448 9357492224\n", + "rslt: 2986344448 9357492224\n", + "rslt: 2986344448 9361686528\n", + "rslt: 2969567232 9361686528\n", + "rslt: 2969567232 9361686528\n", + "rslt: 2969567232 9365880832\n", + "rslt: 2952790016 9365880832\n", + "rslt: 2952790016 9365880832\n", + "rslt: 2952790016 9370075136\n", + "rslt: 2936012800 9370075136\n", + "rslt: 2936012800 9370075136\n", + "rslt: 2936012800 9374269440\n", + "rslt: 2919235584 9374269440\n", + "rslt: 2919235584 9374269440\n", + "rslt: 2919235584 9378463744\n", + "rslt: 2902458368 9378463744\n", + "rslt: 2902458368 9378463744\n", + "rslt: 2902458368 9378463744\n", + "rslt: 2885681152 9382658048\n", + "rslt: 2885681152 9382658048\n", + "rslt: 2885681152 9382658048\n", + "rslt: 2868903936 9386852352\n", + "rslt: 2868903936 9386852352\n", + "rslt: 2868903936 9386852352\n", + "rslt: 2852126720 9391046656\n", + "rslt: 2852126720 9391046656\n", + "rslt: 2852126720 9391046656\n", + "rslt: 2835349504 9395240960\n", + "rslt: 2835349504 9395240960\n", + "rslt: 2835349504 9395240960\n", + "rslt: 2818572288 9399435264\n", + "rslt: 2818572288 9399435264\n", + "rslt: 2818572288 9399435264\n", + "rslt: 2801795072 9403629568\n", + "rslt: 2801795072 9403629568\n", + "rslt: 2801795072 9403629568\n", + "rslt: 2785017856 9407823872\n", + "rslt: 2785017856 9407823872\n", + "rslt: 2785017856 9407823872\n", + "rslt: 2768240640 9407823872\n", + "rslt: 2768240640 9412018176\n", + "rslt: 2768240640 9412018176\n", + "rslt: 2751463424 9412018176\n", + "rslt: 2751463424 9416212480\n", + "rslt: 2751463424 9416212480\n", + "rslt: 2734686208 9416212480\n", + "rslt: 2734686208 9420406784\n", + "rslt: 2734686208 9420406784\n", + "rslt: 2717908992 9420406784\n", + "rslt: 2717908992 9424601088\n", + "rslt: 2717908992 9424601088\n", + "rslt: 2701131776 9424601088\n", + "rslt: 2701131776 9428795392\n", + "rslt: 2701131776 9428795392\n", + "rslt: 2684354560 9428795392\n", + "rslt: 2684354560 9432989696\n", + "rslt: 2684354560 9432989696\n", + "rslt: 2667577344 9432989696\n", + "rslt: 2667577344 9437184000\n", + "rslt: 2667577344 9437184000\n", + "rslt: 2650800128 9437184000\n", + "rslt: 2650800128 9437184000\n", + "rslt: 2650800128 9441378304\n", + "rslt: 2634022912 9441378304\n", + "rslt: 2634022912 9441378304\n", + "rslt: 2634022912 9445572608\n", + "rslt: 2617245696 9445572608\n", + "rslt: 2617245696 9445572608\n", + "rslt: 2617245696 9449766912\n", + "rslt: 2600468480 9449766912\n", + "rslt: 2600468480 9449766912\n", + "rslt: 2600468480 9453961216\n", + "rslt: 2583691264 9453961216\n", + "rslt: 2583691264 9453961216\n", + "rslt: 2583691264 9458155520\n", + "rslt: 2566914048 9458155520\n", + "rslt: 2566914048 9458155520\n", + "rslt: 2566914048 9462349824\n", + "rslt: 2550136832 9462349824\n", + "rslt: 2550136832 9462349824\n", + "rslt: 2550136832 9466544128\n", + "rslt: 2533359616 9466544128\n", + "rslt: 2533359616 9466544128\n", + "rslt: 2533359616 9466544128\n", + "rslt: 2516582400 9470738432\n", + "rslt: 2516582400 9470738432\n", + "rslt: 2516582400 9470738432\n", + "rslt: 2499805184 9474932736\n", + "rslt: 2499805184 9474932736\n", + "rslt: 2499805184 9474932736\n", + "rslt: 2483027968 9479127040\n", + "rslt: 2483027968 9479127040\n", + "rslt: 2483027968 9479127040\n", + "rslt: 2483027968 9483321344\n", + "rslt: 2466250752 9483321344\n", + "rslt: 2466250752 9483321344\n", + "rslt: 2466250752 9487515648\n", + "rslt: 2449473536 9487515648\n", + "rslt: 2449473536 9487515648\n", + "rslt: 2449473536 9491709952\n", + "rslt: 2432696320 9491709952\n", + "rslt: 2432696320 9491709952\n", + "rslt: 2432696320 9495904256\n", + "rslt: 2415919104 9495904256\n", + "rslt: 2415919104 9495904256\n", + "rslt: 2415919104 9495904256\n", + "rslt: 2399141888 9500098560\n", + "rslt: 2399141888 9500098560\n", + "rslt: 2399141888 9500098560\n", + "rslt: 2382364672 9504292864\n", + "rslt: 2382364672 9504292864\n", + "rslt: 2382364672 9504292864\n", + "rslt: 2365587456 9508487168\n", + "rslt: 2365587456 9508487168\n", + "rslt: 2365587456 9508487168\n", + "rslt: 2348810240 9512681472\n", + "rslt: 2348810240 9512681472\n", + "rslt: 2348810240 9512681472\n", + "rslt: 2332033024 9516875776\n", + "rslt: 2332033024 9516875776\n", + "rslt: 2332033024 9516875776\n", + "rslt: 2315255808 9521070080\n", + "rslt: 2315255808 9521070080\n", + "rslt: 2315255808 9521070080\n", + "rslt: 2298478592 9525264384\n", + "rslt: 2298478592 9525264384\n", + "rslt: 2298478592 9525264384\n", + "rslt: 2281701376 9525264384\n", + "rslt: 2281701376 9529458688\n", + "rslt: 2281701376 9529458688\n", + "rslt: 2264924160 9529458688\n", + "rslt: 2264924160 9533652992\n", + "rslt: 2264924160 9533652992\n", + "rslt: 2248146944 9533652992\n", + "rslt: 2248146944 9537847296\n", + "rslt: 2248146944 9537847296\n", + "rslt: 2231369728 9537847296\n", + "rslt: 2231369728 9542041600\n", + "rslt: 2231369728 9542041600\n", + "rslt: 2214592512 9542041600\n", + "rslt: 2214592512 9546235904\n", + "rslt: 2214592512 9546235904\n", + "rslt: 2197815296 9546235904\n", + "rslt: 2197815296 9550430208\n", + "rslt: 2197815296 9550430208\n", + "rslt: 2181038080 9550430208\n", + "rslt: 2181038080 9554624512\n", + "rslt: 2181038080 9554624512\n", + "rslt: 2164260864 9554624512\n", + "rslt: 2164260864 9554624512\n", + "rslt: 2164260864 9558818816\n", + "rslt: 2147483648 9558818816\n", + "rslt: 2147483648 9558818816\n", + "rslt: 2147483648 9563013120\n", + "rslt: 2130706432 9563013120\n", + "rslt: 2130706432 9563013120\n", + "rslt: 2130706432 9567207424\n", + "rslt: 2113929216 9567207424\n", + "rslt: 2113929216 9567207424\n", + "rslt: 2113929216 9571401728\n", + "rslt: 2097152000 9571401728\n", + "rslt: 2097152000 9571401728\n", + "rslt: 2097152000 9575596032\n", + "rslt: 2080374784 9575596032\n", + "rslt: 2080374784 9575596032\n", + "rslt: 2080374784 9579790336\n", + "rslt: 2063597568 9579790336\n", + "rslt: 2063597568 9579790336\n", + "rslt: 2063597568 9579790336\n", + "rslt: 2046820352 9583984640\n", + "rslt: 2046820352 9583984640\n", + "rslt: 2046820352 9583984640\n", + "rslt: 2030043136 9588178944\n", + "rslt: 2030043136 9588178944\n", + "rslt: 2030043136 9588178944\n", + "rslt: 2013265920 9592373248\n", + "rslt: 2013265920 9592373248\n", + "rslt: 2013265920 9592373248\n", + "rslt: 1996488704 9596567552\n", + "rslt: 1996488704 9596567552\n", + "rslt: 1996488704 9596567552\n", + "rslt: 1979711488 9600761856\n", + "rslt: 1979711488 9600761856\n", + "rslt: 1979711488 9600761856\n", + "rslt: 1962934272 9604956160\n", + "rslt: 1962934272 9604956160\n", + "rslt: 1962934272 9604956160\n", + "rslt: 1946157056 9609150464\n", + "rslt: 1946157056 9609150464\n", + "rslt: 1946157056 9609150464\n", + "rslt: 1929379840 9609150464\n", + "rslt: 1929379840 9613344768\n", + "rslt: 1929379840 9613344768\n", + "rslt: 1912602624 9613344768\n", + "rslt: 1912602624 9617539072\n", + "rslt: 1912602624 9617539072\n", + "rslt: 1895825408 9617539072\n", + "rslt: 1895825408 9621733376\n", + "rslt: 1895825408 9621733376\n", + "rslt: 1879048192 9621733376\n", + "rslt: 1879048192 9625927680\n", + "rslt: 1879048192 9625927680\n", + "rslt: 1862270976 9625927680\n", + "rslt: 1862270976 9630121984\n", + "rslt: 1862270976 9630121984\n", + "rslt: 1845493760 9630121984\n", + "rslt: 1845493760 9634316288\n", + "rslt: 1845493760 9634316288\n", + "rslt: 1828716544 9634316288\n", + "rslt: 1828716544 9638510592\n", + "rslt: 1828716544 9638510592\n", + "rslt: 1811939328 9638510592\n", + "rslt: 1811939328 9638510592\n", + "rslt: 1811939328 9642704896\n", + "rslt: 1795162112 9642704896\n", + "rslt: 1795162112 9642704896\n", + "rslt: 1795162112 9646899200\n", + "rslt: 1778384896 9646899200\n", + "rslt: 1778384896 9646899200\n", + "rslt: 1778384896 9651093504\n", + "rslt: 1761607680 9651093504\n", + "rslt: 1761607680 9651093504\n", + "rslt: 1761607680 9655287808\n", + "rslt: 1744830464 9655287808\n", + "rslt: 1744830464 9655287808\n", + "rslt: 1744830464 9659482112\n", + "rslt: 1728053248 9659482112\n", + "rslt: 1728053248 9659482112\n", + "rslt: 1728053248 9663676416\n", + "rslt: 1711276032 9663676416\n", + "rslt: 1711276032 9663676416\n", + "rslt: 1711276032 9667870720\n", + "rslt: 1694498816 9667870720\n", + "rslt: 1694498816 9667870720\n", + "rslt: 1694498816 9667870720\n", + "rslt: 1677721600 9672065024\n", + "rslt: 1677721600 9672065024\n", + "rslt: 1677721600 9672065024\n", + "rslt: 1660944384 9676259328\n", + "rslt: 1660944384 9676259328\n", + "rslt: 1660944384 9676259328\n", + "rslt: 1644167168 9680453632\n", + "rslt: 1644167168 9680453632\n", + "rslt: 1644167168 9680453632\n", + "rslt: 1627389952 9684647936\n", + "rslt: 1627389952 9684647936\n", + "rslt: 1627389952 9684647936\n", + "rslt: 1610612736 9688842240\n", + "rslt: 1610612736 9688842240\n", + "rslt: 1610612736 9688842240\n", + "rslt: 1593835520 9693036544\n", + "rslt: 1593835520 9693036544\n", + "rslt: 1593835520 9693036544\n", + "rslt: 1577058304 9697230848\n", + "rslt: 1577058304 9697230848\n", + "rslt: 1577058304 9697230848\n", + "rslt: 1560281088 9697230848\n", + "rslt: 1560281088 9701425152\n", + "rslt: 1560281088 9701425152\n", + "rslt: 1543503872 9701425152\n", + "rslt: 1543503872 9705619456\n", + "rslt: 1543503872 9705619456\n", + "rslt: 1526726656 9705619456\n", + "rslt: 1526726656 9709813760\n", + "rslt: 1526726656 9709813760\n", + "rslt: 1509949440 9709813760\n", + "rslt: 1509949440 9714008064\n", + "rslt: 1509949440 9714008064\n", + "rslt: 1493172224 9714008064\n", + "rslt: 1493172224 9718202368\n", + "rslt: 1493172224 9718202368\n", + "rslt: 1476395008 9718202368\n", + "rslt: 1476395008 9722396672\n", + "rslt: 1476395008 9722396672\n", + "rslt: 1459617792 9722396672\n", + "rslt: 1459617792 9726590976\n", + "rslt: 1459617792 9726590976\n", + "rslt: 1442840576 9726590976\n", + "rslt: 1442840576 9726590976\n", + "rslt: 1442840576 9730785280\n", + "rslt: 1426063360 9730785280\n", + "rslt: 1426063360 9730785280\n", + "rslt: 1426063360 9734979584\n", + "rslt: 1409286144 9734979584\n", + "rslt: 1409286144 9734979584\n", + "rslt: 1409286144 9739173888\n", + "rslt: 1392508928 9739173888\n", + "rslt: 1392508928 9739173888\n", + "rslt: 1392508928 9743368192\n", + "rslt: 1375731712 9743368192\n", + "rslt: 1375731712 9743368192\n", + "rslt: 1375731712 9747562496\n", + "rslt: 1358954496 9747562496\n", + "rslt: 1358954496 9747562496\n", + "rslt: 1358954496 9751756800\n", + "rslt: 1342177280 9751756800\n", + "rslt: 1342177280 9751756800\n", + "rslt: 1342177280 9755951104\n", + "rslt: 1325400064 9755951104\n", + "rslt: 1325400064 9755951104\n", + "rslt: 1325400064 9755951104\n", + "rslt: 1308622848 9760145408\n", + "rslt: 1308622848 9760145408\n", + "rslt: 1308622848 9760145408\n", + "rslt: 1308622848 9764339712\n", + "rslt: 1291845632 9764339712\n", + "rslt: 1291845632 9764339712\n", + "rslt: 1291845632 9768534016\n", + "rslt: 1275068416 9768534016\n", + "rslt: 1275068416 9768534016\n", + "rslt: 1275068416 9772728320\n", + "rslt: 1258291200 9772728320\n", + "rslt: 1258291200 9772728320\n", + "rslt: 1258291200 9776922624\n", + "rslt: 1241513984 9776922624\n", + "rslt: 1241513984 9776922624\n", + "rslt: 1241513984 9781116928\n", + "rslt: 1224736768 9781116928\n", + "rslt: 1224736768 9781116928\n", + "rslt: 1224736768 9785311232\n", + "rslt: 1207959552 9785311232\n", + "rslt: 1207959552 9785311232\n", + "rslt: 1207959552 9785311232\n", + "rslt: 1191182336 9789505536\n", + "rslt: 1191182336 9789505536\n", + "rslt: 1191182336 9789505536\n", + "rslt: 1174405120 9793699840\n", + "rslt: 1174405120 9793699840\n", + "rslt: 1174405120 9793699840\n", + "rslt: 1157627904 9797894144\n", + "rslt: 1157627904 9797894144\n", + "rslt: 1157627904 9797894144\n", + "rslt: 1140850688 9802088448\n", + "rslt: 1140850688 9802088448\n", + "rslt: 1140850688 9802088448\n", + "rslt: 1124073472 9806282752\n", + "rslt: 1124073472 9806282752\n", + "rslt: 1124073472 9806282752\n", + "rslt: 1107296256 9810477056\n", + "rslt: 1107296256 9810477056\n", + "rslt: 1107296256 9810477056\n", + "rslt: 1090519040 9810477056\n", + "rslt: 1090519040 9814671360\n", + "rslt: 1090519040 9814671360\n", + "rslt: 1073741824 9814671360\n", + "rslt: 1073741824 9818865664\n", + "rslt: 1073741824 9818865664\n", + "rslt: 1056964608 9818865664\n", + "rslt: 1056964608 9823059968\n", + "rslt: 1056964608 9823059968\n", + "rslt: 1040187392 9823059968\n", + "rslt: 1040187392 9827254272\n", + "rslt: 1040187392 9827254272\n", + "rslt: 1023410176 9827254272\n", + "rslt: 1023410176 9831448576\n", + "rslt: 1023410176 9831448576\n", + "rslt: 1006632960 9831448576\n", + "rslt: 1006632960 9835642880\n", + "rslt: 1006632960 9835642880\n", + "rslt: 989855744 9835642880\n", + "rslt: 989855744 9839837184\n", + "rslt: 989855744 9839837184\n", + "rslt: 973078528 9839837184\n", + "rslt: 973078528 9839837184\n", + "rslt: 973078528 9844031488\n", + "rslt: 956301312 9844031488\n", + "rslt: 956301312 9844031488\n", + "rslt: 956301312 9848225792\n", + "rslt: 939524096 9848225792\n", + "rslt: 939524096 9848225792\n", + "rslt: 939524096 9852420096\n", + "rslt: 922746880 9852420096\n", + "rslt: 922746880 9852420096\n", + "rslt: 922746880 9856614400\n", + "rslt: 905969664 9856614400\n", + "rslt: 905969664 9856614400\n", + "rslt: 905969664 9860808704\n", + "rslt: 889192448 9860808704\n", + "rslt: 889192448 9860808704\n", + "rslt: 889192448 9865003008\n", + "rslt: 872415232 9865003008\n", + "rslt: 872415232 9865003008\n", + "rslt: 872415232 9869197312\n", + "rslt: 855638016 9869197312\n", + "rslt: 855638016 9869197312\n", + "rslt: 855638016 9869197312\n", + "rslt: 838860800 9873391616\n", + "rslt: 838860800 9873391616\n", + "rslt: 838860800 9873391616\n", + "rslt: 822083584 9877585920\n", + "rslt: 822083584 9877585920\n", + "rslt: 822083584 9877585920\n", + "rslt: 805306368 9881780224\n", + "rslt: 805306368 9881780224\n", + "rslt: 805306368 9881780224\n", + "rslt: 788529152 9885974528\n", + "rslt: 788529152 9885974528\n", + "rslt: 788529152 9885974528\n", + "rslt: 771751936 9890168832\n", + "rslt: 771751936 9890168832\n", + "rslt: 771751936 9890168832\n", + "rslt: 754974720 9894363136\n", + "rslt: 754974720 9894363136\n", + "rslt: 754974720 9894363136\n", + "rslt: 738197504 9898557440\n", + "rslt: 738197504 9898557440\n", + "rslt: 738197504 9898557440\n", + "rslt: 721420288 9898557440\n", + "rslt: 721420288 9902751744\n", + "rslt: 721420288 9902751744\n", + "rslt: 704643072 9902751744\n", + "rslt: 704643072 9906946048\n", + "rslt: 704643072 9906946048\n", + "rslt: 687865856 9906946048\n", + "rslt: 687865856 9911140352\n", + "rslt: 687865856 9911140352\n", + "rslt: 671088640 9911140352\n", + "rslt: 671088640 9915334656\n", + "rslt: 671088640 9915334656\n", + "rslt: 654311424 9915334656\n", + "rslt: 654311424 9919528960\n", + "rslt: 654311424 9919528960\n", + "rslt: 637534208 9919528960\n", + "rslt: 637534208 9923723264\n", + "rslt: 637534208 9923723264\n", + "rslt: 620756992 9923723264\n", + "rslt: 620756992 9927917568\n", + "rslt: 620756992 9927917568\n", + "rslt: 603979776 9927917568\n", + "rslt: 603979776 9927917568\n", + "rslt: 603979776 9932111872\n", + "rslt: 587202560 9932111872\n", + "rslt: 587202560 9932111872\n", + "rslt: 587202560 9936306176\n", + "rslt: 570425344 9936306176\n", + "rslt: 570425344 9936306176\n", + "rslt: 570425344 9940500480\n", + "rslt: 553648128 9940500480\n", + "rslt: 553648128 9940500480\n", + "rslt: 553648128 9944694784\n", + "rslt: 536870912 9944694784\n", + "rslt: 536870912 9944694784\n", + "rslt: 536870912 9948889088\n", + "rslt: 520093696 9948889088\n", + "rslt: 520093696 9948889088\n", + "rslt: 520093696 9953083392\n", + "rslt: 503316480 9953083392\n", + "rslt: 503316480 9953083392\n", + "rslt: 503316480 9957277696\n", + "rslt: 486539264 9957277696\n", + "rslt: 486539264 9957277696\n", + "rslt: 486539264 9957277696\n", + "rslt: 469762048 9961472000\n", + "rslt: 469762048 9961472000\n", + "rslt: 469762048 9961472000\n", + "rslt: 452984832 9965666304\n", + "rslt: 452984832 9965666304\n", + "rslt: 452984832 9965666304\n", + "rslt: 436207616 9969860608\n", + "rslt: 436207616 9969860608\n", + "rslt: 436207616 9969860608\n", + "rslt: 419430400 9974054912\n", + "rslt: 419430400 9974054912\n", + "rslt: 419430400 9974054912\n", + "rslt: 402653184 9978249216\n", + "rslt: 402653184 9978249216\n", + "rslt: 402653184 9978249216\n", + "rslt: 385875968 9982443520\n", + "rslt: 385875968 9982443520\n", + "rslt: 385875968 9982443520\n", + "rslt: 369098752 9986637824\n", + "rslt: 369098752 9986637824\n", + "rslt: 369098752 9986637824\n", + "rslt: 352321536 9986637824\n", + "rslt: 352321536 9990832128\n", + "rslt: 352321536 9990832128\n", + "rslt: 335544320 9990832128\n", + "rslt: 335544320 9995026432\n", + "rslt: 335544320 9995026432\n", + "rslt: 318767104 9995026432\n", + "rslt: 318767104 9999220736\n", + "rslt: 318767104 9999220736\n", + "rslt: 301989888 9999220736\n", + "rslt: 301989888 10003415040\n", + "rslt: 301989888 10003415040\n", + "rslt: 285212672 10003415040\n", + "rslt: 285212672 10007609344\n", + "rslt: 285212672 10007609344\n", + "rslt: 268435456 10007609344\n", + "rslt: 268435456 10011803648\n", + "rslt: 268435456 10011803648\n", + "rslt: 251658240 10011803648\n", + "rslt: 251658240 10011803648\n", + "rslt: 251658240 10015997952\n", + "rslt: 234881024 10015997952\n", + "rslt: 234881024 10015997952\n", + "rslt: 234881024 10020192256\n", + "rslt: 218103808 10020192256\n", + "rslt: 218103808 10020192256\n", + "rslt: 218103808 10024386560\n", + "rslt: 201326592 10024386560\n", + "rslt: 201326592 10024386560\n", + "rslt: 201326592 10028580864\n", + "rslt: 184549376 10028580864\n", + "rslt: 184549376 10028580864\n", + "rslt: 184549376 10032775168\n", + "rslt: 167772160 10032775168\n", + "rslt: 167772160 10032775168\n", + "rslt: 167772160 10036969472\n", + "rslt: 150994944 10036969472\n", + "rslt: 150994944 10036969472\n", + "rslt: 150994944 10041163776\n", + "rslt: 150994944 10041163776\n", + "rslt: 134217728 10041163776\n", + "rslt: 134217728 10041163776\n", + "rslt: 134217728 10045358080\n", + "rslt: 117440512 10045358080\n", + "rslt: 117440512 10045358080\n", + "rslt: 117440512 10049552384\n", + "rslt: 100663296 10049552384\n", + "rslt: 100663296 10049552384\n", + "rslt: 100663296 10053746688\n", + "rslt: 83886080 10053746688\n", + "rslt: 83886080 10053746688\n", + "rslt: 83886080 10057940992\n", + "rslt: 67108864 10057940992\n", + "rslt: 67108864 10057940992\n", + "rslt: 67108864 10062135296\n", + "rslt: 50331648 10062135296\n", + "rslt: 50331648 10062135296\n", + "rslt: 50331648 10066329600\n", + "rslt: 33554432 10066329600\n", + "rslt: 33554432 10066329600\n", + "rslt: 33554432 10070523904\n", + "rslt: 16777216 10070523904\n", + "rslt: 16777216 10070523904\n", + "rslt: 16777216 10070523904\n", + "rslt: 0 10074718208\n", + "rslt: 0 10074718208\n" + ] + } + ], + "source": [ + "solve(1333310, 5565651, 56070685437719104)" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "56065088460685312" + ] + }, + "execution_count": 35, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "41909485568*1333310+33554432*5565651" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "# 模块" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "寻找系统模块os的位置。" + ] + }, + { + "cell_type": "code", + "execution_count": 120, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "'/usr/lib/python3.5/os.py'" + ] + }, + "execution_count": 120, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# 每个人位置不同,我这里是/usr/lib/python3.5/os.py。\n", + "import os\n", + "os.__file__" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "1. 导入系统模块socket,观察其位置。\n", + "2. 检查`socket._socket`,观察这是什么类型的变量(使用type())。\n", + "3. 对于模块`socket._socket`,观察其位置(如果可能的话)。" + ] + }, + { + "cell_type": "code", + "execution_count": 122, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "/usr/lib/python3.5/socket.py\n", + "\n" + ] + }, + { + "ename": "AttributeError", + "evalue": "module '_socket' has no attribute '__file__'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msocket\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__file__\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtype\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msocket\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_socket\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msocket\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_socket\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__file__\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mAttributeError\u001b[0m: module '_socket' has no attribute '__file__'" + ] + } + ], + "source": [ + "import socket\n", + "print(socket.__file__)\n", + "print(type(socket._socket))\n", + "# 无法直接观察其位置\n", + "print(socket._socket.__file__)" + ] + }, + { + "cell_type": "code", + "execution_count": 127, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "__doc__\n", + "__loader__\n", + "__name__\n", + "__package__\n", + "__spec__\n" + ] + } + ], + "source": [ + "# 观察其内部变量\n", + "for name in dir(socket._socket):\n", + " if name.startswith('_'):\n", + " print(name)" + ] + }, + { + "cell_type": "code", + "execution_count": 131, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "ModuleSpec(name='_socket', loader=, origin='built-in')" + ] + }, + "execution_count": 131, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# 不用费劲了,这是内置模块,编译到python执行文件里去的\n", + "socket._socket.__spec__" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "在当前目录下产生以下包结构:\n", + "\n", + "* p1为一个包。\n", + "* u1, u2为该包的两个模块。\n", + "* i1, i2为u1的两个变量。i1, i2为u2的两个变量。\n", + "* f为p1的一个函数。f不在u1或u2内定义。f输入四个参数,最终返回其中最小的非负整数。\n", + "\n", + "例如\n", + "\n", + " import p1\n", + "\n", + " p1.u1.i1 = 1\n", + " p1.u1.i2 = -2\n", + " p1.u2.i1 = 0.5\n", + " p1.u2.i2 = 4\n", + "\n", + " p1.f(p1.u1.i1, p1.u1.i2, p1.u2.i1, p1.u2.i2)" + ] + }, + { + "cell_type": "code", + "execution_count": 118, + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "1" + ] + }, + "execution_count": 118, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "def f(i1, i2, i3, i4):\n", + " r = None\n", + " for i in [i1, i2, i3, i4]:\n", + " if not isinstance(i, int):\n", + " continue\n", + " if i < 0:\n", + " continue\n", + " if r is None or i < r:\n", + " r = i\n", + " if r is None:\n", + " print('error')\n", + " return r\n", + "\n", + "f(1, -2, 0.5, 4)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "source": [ + "建立目录p1,其中包含三个文件,__init__.py,u1.py,u2.py。\n", + "\n", + " __init__.py:\n", + "\n", + " def f(i1, i2, i3, i4):\n", + " r = None\n", + " for i in [i1, i2, i3, i4]:\n", + " if not isinstance(i, int):\n", + " continue\n", + " if i < 0:\n", + " continue\n", + " if r is None or i < r:\n", + " r = i\n", + " if r is None:\n", + " print('error')\n", + " return r\n", + "\n", + " u1.py:\n", + " i1 = 1\n", + " i2 = -2\n", + "\n", + " u2.py:\n", + " i1 = 0.5\n", + " i2 = 4" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "# 内置数据结构" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "a为[0, 100)数组。请对a进行归一化,产生数组b。使得sum(b) = 1,同时对任意x, y,`0<=x<100`。`a[x]/a[y] == b[x]/b[y]`。" + ] + }, + { + "cell_type": "code", + "execution_count": 139, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]\n", + "[0.0, 0.00020202020202020202, 0.00040404040404040404, 0.0006060606060606061, 0.0008080808080808081, 0.00101010101010101, 0.0012121212121212121, 0.0014141414141414141, 0.0016161616161616162, 0.0018181818181818182, 0.00202020202020202, 0.0022222222222222222, 0.0024242424242424242, 0.0026262626262626263, 0.0028282828282828283, 0.0030303030303030303, 0.0032323232323232323, 0.0034343434343434343, 0.0036363636363636364, 0.0038383838383838384, 0.00404040404040404, 0.004242424242424243, 0.0044444444444444444, 0.004646464646464647, 0.0048484848484848485, 0.005050505050505051, 0.0052525252525252525, 0.005454545454545455, 0.0056565656565656566, 0.005858585858585859, 0.006060606060606061, 0.006262626262626263, 0.006464646464646465, 0.006666666666666667, 0.006868686868686869, 0.007070707070707071, 0.007272727272727273, 0.007474747474747475, 0.007676767676767677, 0.00787878787878788, 0.00808080808080808, 0.008282828282828282, 0.008484848484848486, 0.008686868686868687, 0.008888888888888889, 0.00909090909090909, 0.009292929292929294, 0.009494949494949495, 0.009696969696969697, 0.009898989898989899, 0.010101010101010102, 0.010303030303030303, 0.010505050505050505, 0.010707070707070707, 0.01090909090909091, 0.011111111111111112, 0.011313131313131313, 0.011515151515151515, 0.011717171717171718, 0.01191919191919192, 0.012121212121212121, 0.012323232323232323, 0.012525252525252526, 0.012727272727272728, 0.01292929292929293, 0.013131313131313131, 0.013333333333333334, 0.013535353535353536, 0.013737373737373737, 0.013939393939393939, 0.014141414141414142, 0.014343434343434344, 0.014545454545454545, 0.014747474747474747, 0.01494949494949495, 0.015151515151515152, 0.015353535353535354, 0.015555555555555555, 0.01575757575757576, 0.01595959595959596, 0.01616161616161616, 0.016363636363636365, 0.016565656565656565, 0.016767676767676768, 0.01696969696969697, 0.01717171717171717, 0.017373737373737375, 0.017575757575757574, 0.017777777777777778, 0.01797979797979798, 0.01818181818181818, 0.018383838383838384, 0.018585858585858588, 0.018787878787878787, 0.01898989898989899, 0.01919191919191919, 0.019393939393939394, 0.019595959595959597, 0.019797979797979797, 0.02]\n" + ] + } + ], + "source": [ + "a = list(range(100))\n", + "print(a)\n", + "s = sum(a)\n", + "print([i/s for i in a])" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "回朔法求解Eight queens puzzle" + ] + }, + { + "cell_type": "code", + "execution_count": 148, + "metadata": { + "collapsed": true, + "slideshow": { + "slide_type": "notes" + } + }, + "outputs": [], + "source": [ + "# TODO:" + ] + } + ], + "metadata": { + "celltoolbar": "Slideshow", + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git "a/101-Python345円205円245円351円227円250円.ipynb" "b/101-Python345円205円245円351円227円250円.ipynb" index 113a343..9538d94 100644 --- "a/101-Python345円205円245円351円227円250円.ipynb" +++ "b/101-Python345円205円245円351円227円250円.ipynb" @@ -1,5737 +1,5584 @@ { - "metadata": { - "celltoolbar": "Slideshow", - "name": "", - "signature": "sha256:7ca92165037692606a3b404d1d2be3afacf7a5404c7a038c1ed44ebf258f9fc8" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ + "cells": [ { - "cells": [ - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "slide" - } - }, - "source": [ - "# Python\u5165\u95e8" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## License\n", - "\n", - "CC-BY-SA 4.0\n", - "\n", - "\u5927\u90e8\u5206\u5185\u5bb9\u6765\u81ea\u201da byte of python\u201d\uff0c\u5728\u6b64\u611f\u8c22\u4f5c\u8005\u3002\n", - "\n", - "http://python.swaroopch.com/" - ] - }, + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "# Python入门" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## License\n", + "\n", + "CC-BY-SA 4.0\n", + "\n", + "大部分内容来自"a byte of python",在此感谢作者。\n", + "\n", + "http://python.swaroopch.com/" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## Python的历史\n", + "\n", + "作者:Guido van Rossum\n", + "\n", + "首次发行时间:1991\n", + "\n", + "版本系列:2.7 / 3.8\n", + "\n", + "分类:强类型动态语言\n", + "\n", + "支持系统:几乎全部" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 本讲义的兼容性\n", + "\n", + "本讲义的基础环境为Python3.8,代码保证在3.8上可运行。原则上可兼容Python2.7,Python3.3-3.7,但是并未一一测试。如发现问题可反馈。\n", + "\n", + "其中部分代码有少量代码有2/3不兼容现象,在讲课时会特别提出。\n", + "\n", + "本讲义的系统环境为Linux(Debian Buster),有少量指令在Windows下有变化,亦会特别提出。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## Python的成功案例\n", + "\n", + "知名公司\n", + "\n", + "* Industrial Light & Magic (工业光魔) 电影制作\n", + "* D-Link Australia Firmware更新\n", + "* Odoo ERP产品\n", + "* Douban 全站\n", + "* Eleme 全站\n", + "\n", + "知名应用\n", + "\n", + "* Django 网页开发\n", + "* Odoo ERP产品\n", + "* OpenStack 虚拟化管理平台\n", + "* SaltStack 自动化运维\n", + "* Ansible 自动化运维\n", + "* Pandas 数据分析\n", + "* PySpark 内存计算\n", + "* TensorFlow 机器学习" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "# 基础环境准备" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## Python环境安装\n", + "\n", + "Windows/MacOS:\n", + "\n", + "1. 访问 https://www.python.org/downloads/\n", + "2. 下载合适的版本\n", + "3. 点击安装\n", + "\n", + "Linux:\n", + "\n", + "1. 多数系统自带\n", + "2. 请找对应系统手册" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## Python运行交互界面\n", + "\n", + "在命令行下执行python,进入Python交互界面。类似这样:\n", + "\n", + " Python 3.7.3 (default, Dec 20 2019, 18:57:59) \n", + " [GCC 8.3.0] on linux\n", + " Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n", + ">>> \n", + "\n", + "出现这个界面,说明你正常的安装了python。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## Jupyter演示界面\n", + "\n", + "Jupyter是一种记事本工具。可以插入代码,进行执行,显示结果,并把这些内容保存成记事本以供后续查阅。\n", + "\n", + "下面我们会大量使用Jupyter进行代码执行展示。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 简单命令测试\n", + "\n", + "在交互界面敲入1 + 2,出现如下结果:\n", + "\n", + ">>> 1 + 2\n", + " 3\n", + "\n", + "在交互界面敲入print(‘1+2’),出现如下结果:\n", + "\n", + ">>> print('1+2')\n", + " 1+2" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } + "data": { + "text/plain": [ + "3" + ] }, - "source": [ - "## python\u7684\u5386\u53f2\n", - "\n", - "\u4f5c\u8005\uff1aGuido van Rossum\n", - "\n", - "\u9996\u6b21\u53d1\u884c\u65f6\u95f4\uff1a1991\n", - "\n", - "\u7248\u672c\u7cfb\u5217\uff1a2.7 / 3.5\n", - "\n", - "\u5206\u7c7b\uff1a\u5f3a\u7c7b\u578b\u52a8\u6001\u8bed\u8a00\n", - "\n", - "\u652f\u6301\u7cfb\u7edf\uff1a\u51e0\u4e4e\u5168\u90e8" - ] - }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "1 + 2" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u672c\u8bb2\u4e49\u7684\u517c\u5bb9\u6027\n", - "\n", - "\u672c\u8bb2\u4e49\u7684\u57fa\u7840\u73af\u5883\u4e3apython2.7/3.5\u3002\u4ee3\u7801\u5728\u8fd9\u4e24\u79cd\u7cfb\u7edf\u4e0a\u6d4b\u8bd5\u901a\u8fc7\u3002\n", - "\n", - "\u5176\u4e2d\u6709\u5c11\u91cf\u4ee3\u7801\u67092/3\u4e0d\u517c\u5bb9\u73b0\u8c61\uff0c\u5728\u8bb2\u8bfe\u65f6\u4f1a\u7279\u522b\u63d0\u51fa\u3002\n", - "\n", - "\u672c\u8bb2\u4e49\u7684\u7cfb\u7edf\u73af\u5883\u4e3aLinux(Debian Stretch)\uff0c\u6709\u5c11\u91cf\u6307\u4ee4\u5728windows\u4e0b\u6709\u53d8\u5316\uff0c\u4ea6\u4f1a\u7279\u522b\u63d0\u51fa\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "1+2\n" ] - }, + } + ], + "source": [ + "print('1+2')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 文件编辑和执行\n", + "\n", + "用任意编辑器(随你喜欢)新建一文件,修改内容为print('1+2'),然后将其保存为xxx.py文件。\n", + "\n", + "然后用python执行文件:python xxx.py\n", + "\n", + "注意,如果python不在默认路径中(常见于windows),需要写完整路径。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "以下代码,%%开头的为jupyter内部指令。writefile为写入文件。\n", + "\n", + "!开头的为系统指令。cat和rm为linux系统指令,windows下需要做变更。" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## Python\u7684\u6210\u529f\u6848\u4f8b\n", - "\n", - "\u77e5\u540d\u516c\u53f8\n", - "\n", - "* Industrial Light & Magic (\u5de5\u4e1a\u5149\u9b54) \u7535\u5f71\u5236\u4f5c\n", - "* D-Link Australia Firmware\u66f4\u65b0\n", - "* Odoo ERP\u4ea7\u54c1\n", - "* Douban \u5168\u7ad9\n", - "* Eleme \u5168\u7ad9\n", - "\n", - "\u77e5\u540d\u5e94\u7528\n", - "\n", - "* Django \u7f51\u9875\u5f00\u53d1\n", - "* Odoo ERP\u4ea7\u54c1\n", - "* OpenStack \u865a\u62df\u5316\u7ba1\u7406\u5e73\u53f0\n", - "* SaltStack \u81ea\u52a8\u5316\u8fd0\u7ef4\n", - "* Ansible \u81ea\u52a8\u5316\u8fd0\u7ef4\n", - "* Pandas \u6570\u636e\u5206\u6790\n", - "* PySpark \u5185\u5b58\u8ba1\u7b97\n", - "* TensorFlow \u673a\u5668\u5b66\u4e60" + "name": "stdout", + "output_type": "stream", + "text": [ + "Writing test.py\n" ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "slide" - } - }, - "source": [ - "# \u57fa\u7840\u73af\u5883\u51c6\u5907" + } + ], + "source": [ + "%%writefile test.py\n", + "print('1+2')" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "print('1+2')" ] - }, + } + ], + "source": [ + "!cat test.py" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## python\u73af\u5883\u5b89\u88c5\n", - "\n", - "Windows/MacOS:\n", - "\n", - "1. \u8bbf\u95ee https://www.python.org/downloads/\n", - "2. \u4e0b\u8f7d\u5408\u9002\u7684\u7248\u672c\n", - "3. \u70b9\u51fb\u5b89\u88c5\n", - "\n", - "Linux:\n", - "\n", - "1. \u591a\u6570\u7cfb\u7edf\u81ea\u5e26\n", - "2. \u8bf7\u627e\u5bf9\u5e94\u7cfb\u7edf\u624b\u518c" + "name": "stdout", + "output_type": "stream", + "text": [ + "1+2\r\n" ] - }, + } + ], + "source": [ + "!python test.py" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "outputs": [], + "source": [ + "!rm test.py" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "# Python基本语法" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 基本类型\n", + "\n", + "* 注释:以#开头的为注释,直到行结束为止。\n", + "* 数字:以数字,.或者-开头的为数字。带小数点.的为浮点数,不带小数点的为整数。支持科学计数法,例如52.3E-4。可以以\\_作为分隔,增强可读性,例如1\\_000\\_000。\n", + "* 字符串:以单引号’,双引号",三引号’’’开始,同样符号结束。\n", + "* 布尔值:只有两个,True和False。大小写敏感。\n", + "* 空值:只有一个,None。大小写敏感。表示没有值的值。\n", + "\n", + "练习:写出数字和字符串的例子,并加以注释。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 例子" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } + "data": { + "text/plain": [ + "0.00523" + ] }, - "source": [ - "## python\u8fd0\u884c\u4ea4\u4e92\u754c\u9762\n", - "\n", - "\u5728\u547d\u4ee4\u884c\u4e0b\u6267\u884cpython\uff0c\u8fdb\u5165python\u4ea4\u4e92\u754c\u9762\u3002\u7c7b\u4f3c\u8fd9\u6837\uff1a\n", - "\n", - " Python 2.7.11+ (default, Apr 17 2016, 14:00:29)\n", - " [GCC 5.3.1 20160409] on linux2\n", - " Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n", - ">>>\n", - "\n", - "\u51fa\u73b0\u8fd9\u4e2a\u754c\u9762\uff0c\u8bf4\u660e\u4f60\u6b63\u5e38\u7684\u5b89\u88c5\u4e86python\u3002" - ] - }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "52.3E-4" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } + "data": { + "text/plain": [ + "'string'" + ] }, - "source": [ - "## Jupyter\u6f14\u793a\u754c\u9762\n", - "\n", - "Jupyter\u662f\u4e00\u79cd\u8bb0\u4e8b\u672c\u5de5\u5177\u3002\u53ef\u4ee5\u63d2\u5165\u4ee3\u7801\uff0c\u8fdb\u884c\u6267\u884c\uff0c\u663e\u793a\u7ed3\u679c\uff0c\u5e76\u628a\u8fd9\u4e9b\u5185\u5bb9\u4fdd\u5b58\u6210\u8bb0\u4e8b\u672c\u4ee5\u4f9b\u540e\u7eed\u67e5\u9605\u3002\n", - "\n", - "\u4e0b\u9762\u6211\u4eec\u4f1a\u5927\u91cf\u4f7f\u7528Jupyter\u8fdb\u884c\u4ee3\u7801\u6267\u884c\u5c55\u793a\u3002" - ] - }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "'string'" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } + "data": { + "text/plain": [ + "'string'" + ] }, - "source": [ - "## \u7b80\u5355\u547d\u4ee4\u6d4b\u8bd5\n", - "\n", - "\u5728\u4ea4\u4e92\u754c\u9762\u6572\u51651 + 2\uff0c\u51fa\u73b0\u5982\u4e0b\u7ed3\u679c\uff1a\n", - "\n", - ">>> 1 + 2\n", - " 3\n", - "\n", - "\u5728\u4ea4\u4e92\u754c\u9762\u6572\u5165print(\u20181+2\u2019)\uff0c\u51fa\u73b0\u5982\u4e0b\u7ed3\u679c\uff1a\n", - ">>> print('1+2')\n", - " 1+2" - ] - }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "\"string\"" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ { - "cell_type": "code", - "collapsed": false, - "input": [ - "1 + 2" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } + "data": { + "text/plain": [ + "'string'" + ] }, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 1, - "text": [ - "3" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "print('1+2')" - ], - "language": "python", + "execution_count": 10, "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "1+2\n" - ] - } - ], - "prompt_number": 2 - }, + "output_type": "execute_result" + } + ], + "source": [ + "'''string'''" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } + "data": { + "text/plain": [ + "True" + ] }, - "source": [ - "## \u6587\u4ef6\u7f16\u8f91\u548c\u6267\u884c\n", - "\n", - "\u7528\u4efb\u610f\u7f16\u8f91\u5668\uff08\u968f\u4f60\u559c\u6b22\uff09\u65b0\u5efa\u4e00\u6587\u4ef6\uff0c\u4fee\u6539\u5185\u5bb9\u4e3aprint('1+2')\uff0c\u7136\u540e\u5c06\u5176\u4fdd\u5b58\u4e3axxx.py\u6587\u4ef6\u3002\n", - "\n", - "\u7136\u540e\u7528python\u6267\u884c\u6587\u4ef6\uff1apython xxx.py\n", - "\n", - "\u6ce8\u610f\uff0c\u5982\u679cpython\u4e0d\u5728\u9ed8\u8ba4\u8def\u5f84\u4e2d\uff08\u5e38\u89c1\u4e8ewindows\uff09\uff0c\u9700\u8981\u5199\u5b8c\u6574\u8def\u5f84\u3002" - ] - }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "True" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } + "data": { + "text/plain": [ + "False" + ] }, - "source": [ - "\u4ee5\u4e0b\u4ee3\u7801\uff0c%%\u5f00\u5934\u7684\u4e3ajupyter\u5185\u90e8\u6307\u4ee4\u3002writefile\u4e3a\u5199\u5165\u6587\u4ef6\u3002\n", - "\n", - "!\u5f00\u5934\u7684\u4e3a\u7cfb\u7edf\u6307\u4ee4\u3002cat\u548crm\u4e3alinux\u7cfb\u7edf\u6307\u4ee4\uff0cwindows\u4e0b\u9700\u8981\u505a\u53d8\u66f4\u3002" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "%%writefile test.py\n", - "print('1+2')" - ], - "language": "python", + "execution_count": 12, "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Writing test.py\n" - ] - } - ], - "prompt_number": 3 - }, + "output_type": "execute_result" + } + ], + "source": [ + "False" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "slideshow": { + "slide_type": "-" + } + }, + "outputs": [ { - "cell_type": "code", - "collapsed": false, - "input": [ - "!cat test.py" - ], - "language": "python", + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 13, "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "print('1+2')" - ] - } - ], - "prompt_number": 4 - }, + "output_type": "execute_result" + } + ], + "source": [ + "1 == 0" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ { - "cell_type": "code", - "collapsed": false, - "input": [ - "!python test.py" - ], - "language": "python", + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 14, "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "1+2\r\n" - ] - } - ], - "prompt_number": 5 - }, + "output_type": "execute_result" + } + ], + "source": [ + "1 == 1" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [], + "source": [ + "None" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 字符串转义\n", + "\n", + "在单引号字符串中表达单引号需要转义,双引号和三引号同。例如:\n", + "\n", + ""what’s wrong"是合法字符串。’what’s wrong’会出错,需要写为’what\\’s wrong’。\n", + "\n", + "转义也可以用于表达不可见字符,例如tab:\\t。\n", + "\n", + "如果要表达\\本身,也需要转义,写为\\\\\\\\。" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ { - "cell_type": "code", - "collapsed": false, - "input": [ - "!rm test.py" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "skip" - } + "data": { + "text/plain": [ + "\"what's wrong\"" + ] }, - "outputs": [], - "prompt_number": 6 - }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "'what\\'s wrong'" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## Raw String\n", + "\n", + "在字符串的开始加r,使得字符串中不发生转义。\n", + "\n", + "常用于大量需要表达\\的字符串。" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "slide" - } + "data": { + "text/plain": [ + "\"what\\\\'s wrong\"" + ] }, - "source": [ - "# Python\u57fa\u672c\u8bed\u6cd5" - ] - }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "r'what\\'s wrong'" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u57fa\u672c\u7c7b\u578b\n", - "\n", - "* \u6ce8\u91ca\uff1a\u4ee5#\u5f00\u5934\u7684\u4e3a\u6ce8\u91ca\uff0c\u76f4\u5230\u884c\u7ed3\u675f\u4e3a\u6b62\u3002\n", - "* \u6570\u5b57\uff1a\u4ee5\u6570\u5b57\uff0c.\u6216\u8005-\u5f00\u5934\u7684\u4e3a\u6570\u5b57\u3002\u5e26\u5c0f\u6570\u70b9.\u7684\u4e3a\u6d6e\u70b9\u6570\uff0c\u4e0d\u5e26\u5c0f\u6570\u70b9\u7684\u4e3a\u6574\u6570\u3002\u652f\u6301\u79d1\u5b66\u8ba1\u6570\u6cd5\uff0c\u4f8b\u598252.3E-4\u3002\n", - "* \u5b57\u7b26\u4e32\uff1a\u4ee5\u5355\u5f15\u53f7\u2019\uff0c\u53cc\u5f15\u53f7\u201d\uff0c\u4e09\u5f15\u53f7\u2019\u2019\u2019\u5f00\u59cb\uff0c\u540c\u6837\u7b26\u53f7\u7ed3\u675f\u3002\n", - "* \u5e03\u5c14\u503c\uff1a\u53ea\u6709\u4e24\u4e2a\uff0cTrue\u548cFalse\u3002\u5927\u5c0f\u5199\u654f\u611f\u3002\n", - "* \u7a7a\u503c\uff1a\u53ea\u6709\u4e00\u4e2a\uff0cNone\u3002\u5927\u5c0f\u5199\u654f\u611f\u3002\u8868\u793a\u6ca1\u6709\u503c\u7684\u503c\u3002\n", - "\n", - "\u7ec3\u4e60\uff1a\u5199\u51fa\u6570\u5b57\u548c\u5b57\u7b26\u4e32\u7684\u4f8b\u5b50\uff0c\u5e76\u52a0\u4ee5\u6ce8\u91ca\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "what\\'s wrong\n" ] - }, + } + ], + "source": [ + "print(r'what\\'s wrong')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## Unicode字符串\n", + "\n", + "在字符串前加u,表示这是一个unicode字符串。前面加b,表示是一个bytes字符串(也叫raw字符串)。如果什么都不加,则看Python版本。Python2中默认为raw字符串,Python3中默认为unicode字符串。\n", + "\n", + "unicode字符串和普通字符串的区别在于。unicode字符串中,每一个位表示一个"字"。而普通字符串中,一个位表示一个字节。\n", + "\n", + "一个"字"可能由一个字节表示,也可能由多个字节表示。尤其是中文的情况下。这种"字符串"在处理文字的时候容易发生混乱。\n", + "\n", + "unicode字符串和普通字符串外形相似,但是很多地方无法混用。" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } + "data": { + "text/plain": [ + "'string'" + ] }, - "source": [ - "## \u4f8b\u5b50" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "52.3E-4" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 7, - "text": [ - "0.00523" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "'string'" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 8, - "text": [ - "'string'" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\"string\"" - ], - "language": "python", + "execution_count": 19, "metadata": {}, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 9, - "text": [ - "'string'" - ] - } - ], - "prompt_number": 9 - }, + "output_type": "execute_result" + } + ], + "source": [ + "u'string'" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [ { - "cell_type": "code", - "collapsed": false, - "input": [ - "'''string'''" - ], - "language": "python", + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 20, "metadata": {}, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 10, - "text": [ - "'string'" - ] - } - ], - "prompt_number": 10 - }, + "output_type": "execute_result" + } + ], + "source": [ + "'string' == u'string'" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ { - "cell_type": "code", - "collapsed": false, - "input": [ - "True" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } + "data": { + "text/plain": [ + "True" + ] }, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 11, - "text": [ - "True" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "False" - ], - "language": "python", + "execution_count": 21, "metadata": {}, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 12, - "text": [ - "False" - ] - } - ], - "prompt_number": 12 - }, + "output_type": "execute_result" + } + ], + "source": [ + "# -*- coding: utf-8 -*-\n", + "'中文' == u'中文'\n", + "# 在Python2下不相等,Python3下相等。因为Python3下都是Unicode。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 变量\n", + "\n", + "变量需要一个名字。\n", + "\n", + "首字母需要是字母或下划线,其余部分可以是字母,下划线和数字。\n", + "\n", + "变量大小写敏感,但是使用大小写区分变量是不可取的。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 变量类型\n", + "\n", + "每个变量都会指向一个值,每个值都拥有一个类型。\n", + "\n", + "变量在运行过程中可以指向不同的值,拥有不同的类型。\n", + "\n", + "因此在运行前无法知道名字所对应的类型。(动态类型语言特征)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "# 算符和表达式" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 算符\n", + "\n", + "算符是连接一个或多个元素的符号,用来表达计算。\n", + "\n", + "常见算符:\n", + "\n", + " + - * ** / // % <> & | ^ ~ <=>= == != not and or\n", + "\n", + "算符和赋值的快速写法\n", + "\n", + " a = 10\n", + " a = a + 10\n", + " a += 10" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "source": [ + "可以挑讲常见算符。一般+ - * /需要重点讲解,其他算符可以简单介绍,等到合适的机会再讲。\n", + "\n", + "在这里,/和//算符,2和3的差异是常被提到的话题。//是整数除法,无论参与数是浮点还是整数。\n", + "\n", + "另一个讲解重点在于python不会自动转换类型。这点即是"强类型语言"。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 算符优先级\n", + "\n", + "* lambda\n", + "* if - else\n", + "* or\n", + "* and\n", + "* not\n", + "* in, not in, is, is not, <, <=,>,>=, !=, == \n", + "* |\n", + "* ^\n", + "* &\n", + "* <<,>>\n", + "* +, -\n", + "* *, /, //, %\n", + "* +x, -x, ~x\n", + "* \\*\\*\n", + "* x[index], x[index:index], x(arguments...), x.attribute\n", + "* (expressions...), [expressions...], {key: value...}, {expressions...} \n", + "\n", + "使用()可以改变优先级顺序" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "source": [ + "同样挑讲优先级,重点几乎只有+ - * /之间。101不要全部展开。\n", + "\n", + "优先级的正解应当是尽量使用(),不确定的应当用python去解决而不是大脑。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 练习\n", + "\n", + "计算以下表达式的求值顺序,并求值算出结果:\n", + "\n", + " 1 + 8 <= 1 + 2 * 3\n", + " 1 + 2 and 3 * 4 or 5 ** 6" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "source": [ + "强调值的真假,and和or的运算特性。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 答案" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ { - "cell_type": "code", - "collapsed": false, - "input": [ - "1 == 0" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "-" - } + "data": { + "text/plain": [ + "False" + ] }, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 13, - "text": [ - "False" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "1 == 1" - ], - "language": "python", + "execution_count": 22, "metadata": {}, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 14, - "text": [ - "True" - ] - } - ], - "prompt_number": 14 - }, + "output_type": "execute_result" + } + ], + "source": [ + "1 + 8 <= 1 + 2 * 3" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [ { - "cell_type": "code", - "collapsed": false, - "input": [ - "None" - ], - "language": "python", + "data": { + "text/plain": [ + "12" + ] + }, + "execution_count": 23, "metadata": {}, - "outputs": [], - "prompt_number": 15 - }, + "output_type": "execute_result" + } + ], + "source": [ + "1 + 2 and 3 * 4 or 5 ** 6" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 表达式\n", + "\n", + "表达式为一串由算符连接的元素。\n", + "\n", + "表达式一般会有值,值为按照优先级依次求解表达式得到的结果。\n", + "\n", + "有些表达式在语法上亦不可求值。\n", + "\n", + "表达式除了值以外,还可能造成"副作用"。即造成环境改变,或执行某些操作。" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u5b57\u7b26\u4e32\u8f6c\u4e49\n", - "\n", - "\u5728\u5355\u5f15\u53f7\u5b57\u7b26\u4e32\u4e2d\u8868\u8fbe\u5355\u5f15\u53f7\u9700\u8981\u8f6c\u4e49\uff0c\u53cc\u5f15\u53f7\u548c\u4e09\u5f15\u53f7\u540c\u3002\u4f8b\u5982\uff1a\n", - "\n", - "\u201cwhat\u2019s wrong\u201d\u662f\u5408\u6cd5\u5b57\u7b26\u4e32\u3002\u2019what\u2019s wrong\u2019\u4f1a\u51fa\u9519\uff0c\u9700\u8981\u5199\u4e3a\u2019what\\\u2019s wrong\u2019\u3002\n", - "\n", - "\u8f6c\u4e49\u4e5f\u53ef\u4ee5\u7528\u4e8e\u8868\u8fbe\u4e0d\u53ef\u89c1\u5b57\u7b26\uff0c\u4f8b\u5982tab\uff1a\\t\u3002\n", - "\n", - "\u5982\u679c\u8981\u8868\u8fbe\\\u672c\u8eab\uff0c\u4e5f\u9700\u8981\u8f6c\u4e49\uff0c\u5199\u4e3a\\\\\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "area is 78.5\n" ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "'what\\'s wrong'" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 16, - "text": [ - "\"what's wrong\"" - ] - } - ], - "prompt_number": 16 - }, + } + ], + "source": [ + "Pi = 3.14\n", + "r = 5\n", + "area = Pi * r * r\n", + "print(\"area is {0}\".format(area))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 格式化字符串\n", + "\n", + "将变量的值格式化到字符串中,形成新的字符串。\n", + "\n", + "常用于输出数据内容。" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## Raw String\n", - "\n", - "\u5728\u5b57\u7b26\u4e32\u7684\u5f00\u59cb\u52a0r\uff0c\u4f7f\u5f97\u5b57\u7b26\u4e32\u4e2d\u4e0d\u53d1\u751f\u8f6c\u4e49\u3002\n", - "\n", - "\u5e38\u7528\u4e8e\u5927\u91cf\u9700\u8981\u8868\u8fbe\\\u7684\u5b57\u7b26\u4e32\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "my name is shell and the length of name is 5\n", + "my name is shell and the length of name is 5\n" ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "r'what\\'s wrong'" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 17, - "text": [ - "\"what\\\\'s wrong\"" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "print(r'what\\'s wrong')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "what\\'s wrong\n" - ] - } - ], - "prompt_number": 18 - }, + } + ], + "source": [ + "name = 'shell'\n", + "\n", + "print('my name is {0} and the length of name is {1}'.format(name, len(name)))\n", + "print('my name is %s and the length of name is %d' % (name, len(name)))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "# f-string\n", + "\n", + "借助f-string,我们可以在字符串内直接引用变量,格式化字符串。" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## Unicode\u5b57\u7b26\u4e32\n", - "\n", - "\u5728\u5b57\u7b26\u4e32\u524d\u52a0u\uff0c\u8868\u793a\u8fd9\u662f\u4e00\u4e2aunicode\u5b57\u7b26\u4e32\u3002\n", - "\n", - "unicode\u5b57\u7b26\u4e32\u548c\u666e\u901a\u5b57\u7b26\u4e32\u7684\u533a\u522b\u5728\u4e8e\u3002unicode\u5b57\u7b26\u4e32\u4e2d\uff0c\u6bcf\u4e00\u4e2a\u4f4d\u8868\u793a\u4e00\u4e2a\u201c\u5b57\u201d\u3002\n", - "\n", - "\u800c\u666e\u901a\u5b57\u7b26\u4e32\u4e2d\uff0c\u4e00\u4e2a\u201c\u5b57\u201d\u53ef\u80fd\u7531\u591a\u4e2a\u4f4d\u8868\u793a\u3002\u5c24\u5176\u662f\u4e2d\u6587\u7684\u60c5\u51b5\u4e0b\u3002\n", - "\n", - "unicode\u5b57\u7b26\u4e32\u548c\u666e\u901a\u5b57\u7b26\u4e32\u5916\u5f62\u76f8\u4f3c\uff0c\u4f46\u662f\u5f88\u591a\u5730\u65b9\u65e0\u6cd5\u6df7\u7528\u3002\n", - "\n", - "\u66f4\u8fdb\u4e00\u6b65\u4fe1\u606f\u5728\u201c\u5b57\u7b26\u7f16\u7801\u7b80\u8bf4\u201d\u8fd9\u7ae0\u6709\u8be6\u7ec6\u89e3\u91ca\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "my name is shell and the length of name is 5\n" ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "u'string'" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 19, - "text": [ - "u'string'" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "'string' == u'string'" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 20, - "text": [ - "True" - ] - } - ], - "prompt_number": 20 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# -*- coding: utf-8 -*-\n", - "'\u4e2d\u6587' == u'\u4e2d\u6587'\n", - "# \u5728Python2\u4e0b\u4e0d\u76f8\u7b49\uff0cPython3\u4e0b\u76f8\u7b49\u3002\u56e0\u4e3aPython3\u4e0b\u90fd\u662fUnicode\u3002" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stderr", - "text": [ - "-c:2: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal\n" - ] - }, - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 21, - "text": [ - "False" - ] - } - ], - "prompt_number": 21 - }, + } + ], + "source": [ + "name = 'shell'\n", + "\n", + "print(f'my name is {name} and the length of name is {len(name)}')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 练习\n", + "\n", + "* 编写一行代码,打印出hello, world。\n", + "* 假定有变量name,值为你的名字。编写代码打印出hello, [your name]。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "# 执行流控制\n", + "\n", + "执行流控制代码控制流的先后执行顺序。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 逻辑行和物理行\n", + "\n", + "Python语句执行以行为单位。每行可选的可以以分号;结尾。\n", + "\n", + "但是物理上的一行可以包含多个执行单位,例如:" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u53d8\u91cf\n", - "\n", - "\u53d8\u91cf\u9700\u8981\u4e00\u4e2a\u540d\u5b57\u3002\n", - "\n", - "\u9996\u5b57\u6bcd\u9700\u8981\u662f\u5b57\u6bcd\u6216\u4e0b\u5212\u7ebf\uff0c\u5176\u4f59\u90e8\u5206\u53ef\u4ee5\u662f\u5b57\u6bcd\uff0c\u4e0b\u5212\u7ebf\u548c\u6570\u5b57\u3002\n", - "\n", - "\u53d8\u91cf\u5927\u5c0f\u5199\u654f\u611f\uff0c\u4f46\u662f\u4f7f\u7528\u5927\u5c0f\u5199\u533a\u5206\u53d8\u91cf\u662f\u4e0d\u53ef\u53d6\u7684\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "5\n" ] - }, + } + ], + "source": [ + "i = 5; print(i);" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "同一个执行单位也可以拆分为多行,例如:" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u53d8\u91cf\u7c7b\u578b\n", - "\n", - "\u6bcf\u4e2a\u53d8\u91cf\u90fd\u4f1a\u6307\u5411\u4e00\u4e2a\u503c\uff0c\u6bcf\u4e2a\u503c\u90fd\u62e5\u6709\u4e00\u4e2a\u7c7b\u578b\u3002\n", - "\n", - "\u53d8\u91cf\u5728\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u53ef\u4ee5\u6307\u5411\u4e0d\u540c\u7684\u503c\uff0c\u62e5\u6709\u4e0d\u540c\u7684\u7c7b\u578b\u3002\n", - "\n", - "\u56e0\u6b64\u5728\u8fd0\u884c\u524d\u65e0\u6cd5\u77e5\u9053\u540d\u5b57\u6240\u5bf9\u5e94\u7684\u7c7b\u578b\u3002\uff08\u52a8\u6001\u7c7b\u578b\u8bed\u8a00\u7279\u5f81\uff09" + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello, world\n" ] - }, + } + ], + "source": [ + "print(\n", + "'Hello, world')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 格式对齐\n", + "\n", + "Python使用对齐表达逻辑,例如:" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "slide" - } - }, - "source": [ - "# \u7b97\u7b26\u548c\u8868\u8fbe\u5f0f" + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n", + "done\n" ] - }, + } + ], + "source": [ + "a = 1\n", + "if a == 1:\n", + " print('ok')\n", + "print('done')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "-" + } + }, + "source": [ + "当print(‘done’)和if对齐时,必然被执行。而和print(‘ok’)对齐时,在条件下执行。\n", + "\n", + "因此对齐不合适的代码会引发语法错误。" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7b97\u7b26\n", - "\n", - "\u7b97\u7b26\u662f\u8fde\u63a5\u4e00\u4e2a\u6216\u591a\u4e2a\u5143\u7d20\u7684\u7b26\u53f7\uff0c\u7528\u6765\u8868\u8fbe\u8ba1\u7b97\u3002\n", - "\n", - "\u5e38\u89c1\u7b97\u7b26\uff1a\n", - "\n", - " + - * ** / // % <> & | ^ ~ <=>= == != not and or\n", - "\n", - "\u7b97\u7b26\u548c\u8d4b\u503c\u7684\u5feb\u901f\u5199\u6cd5\n", - "\n", - " a = 10\n", - " a = a + 10\n", - " a += 10" + "name": "stdout", + "output_type": "stream", + "text": [ + "done\n", + "------\n", + "ok\n", + "done\n" ] - }, + } + ], + "source": [ + "a = 0\n", + "if a == 1:\n", + " print('ok')\n", + "print('done')\n", + "\n", + "print('------')\n", + "\n", + "a = 1\n", + "if a == 1:\n", + " print('ok')\n", + "print('done')" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "notes" - } - }, - "source": [ - "\u53ef\u4ee5\u6311\u8bb2\u5e38\u89c1\u7b97\u7b26\u3002\u4e00\u822c+ - * /\u9700\u8981\u91cd\u70b9\u8bb2\u89e3\uff0c\u5176\u4ed6\u7b97\u7b26\u53ef\u4ee5\u7b80\u5355\u4ecb\u7ecd\uff0c\u7b49\u5230\u5408\u9002\u7684\u673a\u4f1a\u518d\u8bb2\u3002\n", - "\n", - "\u5728\u8fd9\u91cc\uff0c/\u548c//\u7b97\u7b26\uff0c2\u548c3\u7684\u5dee\u5f02\u662f\u5e38\u88ab\u63d0\u5230\u7684\u8bdd\u9898\u3002//\u662f\u6574\u6570\u9664\u6cd5\uff0c\u65e0\u8bba\u53c2\u4e0e\u6570\u662f\u6d6e\u70b9\u8fd8\u662f\u6574\u6570\u3002\n", - "\n", - "\u53e6\u4e00\u4e2a\u8bb2\u89e3\u91cd\u70b9\u5728\u4e8epython\u4e0d\u4f1a\u81ea\u52a8\u8f6c\u6362\u7c7b\u578b\u3002\u8fd9\u70b9\u5373\u662f\u201c\u5f3a\u7c7b\u578b\u8bed\u8a00\u201d\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "------\n", + "ok\n", + "done\n" ] - }, + } + ], + "source": [ + "a = 0\n", + "if a == 1:\n", + " print('ok')\n", + " print('done')\n", + "\n", + "print('------')\n", + "\n", + "a = 1\n", + "if a == 1:\n", + " print('ok')\n", + " print('done')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 单行写法" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7b97\u7b26\u4f18\u5148\u7ea7\n", - "\n", - "* lambda\n", - "* if - else\n", - "* or\n", - "* and\n", - "* not\n", - "* in, not in, is, is not, <, <=,>,>=, !=, == \n", - "* |\n", - "* ^\n", - "* &\n", - "* <<,>>\n", - "* +, -\n", - "* *, /, //, %\n", - "* +x, -x, ~x\n", - "* \\*\\*\n", - "* x[index], x[index:index], x(arguments...), x.attribute\n", - "* (expressions...), [expressions...], {key: value...}, {expressions...} \n", - "\n", - "\u4f7f\u7528()\u53ef\u4ee5\u6539\u53d8\u4f18\u5148\u7ea7\u987a\u5e8f" + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n" ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "notes" - } - }, - "source": [ - "\u540c\u6837\u6311\u8bb2\u4f18\u5148\u7ea7\uff0c\u91cd\u70b9\u51e0\u4e4e\u53ea\u6709+ - * /\u4e4b\u95f4\u3002101\u4e0d\u8981\u5168\u90e8\u5c55\u5f00\u3002\n", - "\n", - "\u4f18\u5148\u7ea7\u7684\u6b63\u89e3\u5e94\u5f53\u662f\u5c3d\u91cf\u4f7f\u7528()\uff0c\u4e0d\u786e\u5b9a\u7684\u5e94\u5f53\u7528python\u53bb\u89e3\u51b3\u800c\u4e0d\u662f\u5927\u8111\u3002" + } + ], + "source": [ + "if True: print('ok')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## if" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "number: 12\n", + "guess: 23\n", + "No, it is a little lower than that\n", + "Done\n" ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7ec3\u4e60\n", - "\n", - "\u8ba1\u7b97\u4ee5\u4e0b\u8868\u8fbe\u5f0f\u7684\u6c42\u503c\u987a\u5e8f\uff0c\u5e76\u6c42\u503c\u7b97\u51fa\u7ed3\u679c\uff1a\n", - "\n", - " 1 + 8 <= 1 + 2 * 3\n", - " 1 + 2 and 3 * 4 or 5 ** 6" + } + ], + "source": [ + "import random\n", + "# input是python3写法,raw_input是对应的python2写法。\n", + "# 此处四行是Python2/3兼容写法,后续统一写为input,不再出现这四行。\n", + "try:\n", + " input = raw_input\n", + "except NameError:\n", + " pass\n", + "\n", + "number = random.randint(10, 30)\n", + "print('number:', number)\n", + "\n", + "guess = random.randint(10, 30)\n", + "print(\"guess:\", guess)\n", + "if guess == number:\n", + " print('Congratulations, you guessed it.')\n", + " print('(but you do not win any prizes!)')\n", + "elif guess < number:\n", + " print('No, it is a little higher than that')\n", + "else:\n", + " print('No, it is a little lower than that')\n", + "print('Done')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## while" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "number: 61\n", + "guess: 50\n", + "No, it is a little higher than that.\n", + "guess: 75\n", + "No, it is a little lower than that.\n", + "guess: 62\n", + "No, it is a little lower than that.\n", + "guess: 56\n", + "No, it is a little higher than that.\n", + "guess: 59\n", + "No, it is a little higher than that.\n", + "guess: 60\n", + "No, it is a little higher than that.\n", + "guess: 61\n", + "Congratulations, you guessed it.\n", + "The while loop is over.\n", + "Done\n" ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "notes" - } - }, - "source": [ - "\u5f3a\u8c03\u503c\u7684\u771f\u5047\uff0cand\u548cor\u7684\u8fd0\u7b97\u7279\u6027\u3002" + } + ], + "source": [ + "import random\n", + "\n", + "number = random.randint(0, 99)\n", + "print('number:', number)\n", + "\n", + "low = 0\n", + "high = 100\n", + "running = True\n", + "\n", + "while running:\n", + " guess = int((low+high)/2)\n", + " print('guess:', guess)\n", + " if guess == number:\n", + " print('Congratulations, you guessed it.')\n", + " running = False\n", + " elif guess < number:\n", + " print('No, it is a little higher than that.')\n", + " low = guess\n", + " else:\n", + " print('No, it is a little lower than that.')\n", + " high = guess\n", + "else:\n", + " print('The while loop is over.')\n", + "print('Done')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## for" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1\n", + "2\n", + "3\n", + "4\n", + "The for loop is over\n" ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7b54\u6848" + } + ], + "source": [ + "for i in range(1, 5):\n", + " print(i)\n", + "else:\n", + " print('The for loop is over')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## break" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "number: 90\n", + "guess: 50\n", + "No, it is a little higher than that.\n", + "guess: 75\n", + "No, it is a little higher than that.\n", + "guess: 87\n", + "No, it is a little higher than that.\n", + "guess: 93\n", + "No, it is a little lower than that.\n", + "guess: 90\n", + "Congratulations, you guessed it.\n", + "Done\n" ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "1 + 8 <= 1 + 2 * 3" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 22, - "text": [ - "False" - ] - } - ], - "prompt_number": 22 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "1 + 2 and 3 * 4 or 5 ** 6" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 23, - "text": [ - "12" - ] - } - ], - "prompt_number": 23 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u8868\u8fbe\u5f0f\n", - "\n", - "\u8868\u8fbe\u5f0f\u4e3a\u4e00\u4e32\u7531\u7b97\u7b26\u8fde\u63a5\u7684\u5143\u7d20\u3002\n", - "\n", - "\u8868\u8fbe\u5f0f\u4e00\u822c\u4f1a\u6709\u503c\uff0c\u503c\u4e3a\u6309\u7167\u4f18\u5148\u7ea7\u4f9d\u6b21\u6c42\u89e3\u8868\u8fbe\u5f0f\u5f97\u5230\u7684\u7ed3\u679c\u3002\n", - "\n", - "\u6709\u4e9b\u8868\u8fbe\u5f0f\u5728\u8bed\u6cd5\u4e0a\u4ea6\u4e0d\u53ef\u6c42\u503c\u3002\n", - "\n", - "\u8868\u8fbe\u5f0f\u9664\u4e86\u503c\u4ee5\u5916\uff0c\u8fd8\u53ef\u80fd\u9020\u6210\u201c\u526f\u4f5c\u7528\u201d\u3002\u5373\u9020\u6210\u73af\u5883\u6539\u53d8\uff0c\u6216\u6267\u884c\u67d0\u4e9b\u64cd\u4f5c\u3002" + } + ], + "source": [ + "import random\n", + "\n", + "number = random.randint(0, 99)\n", + "print('number:', number)\n", + "\n", + "low = 0\n", + "high = 100\n", + "running = True\n", + "\n", + "while running:\n", + " guess = int((low+high)/2)\n", + " print('guess:', guess)\n", + " if guess == number:\n", + " print('Congratulations, you guessed it.')\n", + " break\n", + " elif guess < number:\n", + " print('No, it is a little higher than that.')\n", + " low = guess\n", + " else:\n", + " print('No, it is a little lower than that.')\n", + " high = guess\n", + "else:\n", + " print('The while loop is over.')\n", + "print('Done')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## continue" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "number: 84\n", + "guess: 50\n", + "No, it is a little higher than that.\n", + "guess: 75\n", + "No, it is a little higher than that.\n", + "guess: 87\n", + "No, it is a little lower than that.\n", + "guess: 81\n", + "No, it is a little higher than that.\n", + "guess: 84\n", + "Congratulations, you guessed it.\n", + "Done\n" ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "Pi = 3.14\n", - "r = 5\n", - "area = Pi * r * r\n", - "print(\"area is {0}\".format(area))" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "area is 78.5\n" - ] - } - ], - "prompt_number": 24 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u683c\u5f0f\u5316\u5b57\u7b26\u4e32\n", - "\n", - "\u5c06\u53d8\u91cf\u7684\u503c\u683c\u5f0f\u5316\u5230\u5b57\u7b26\u4e32\u4e2d\uff0c\u5f62\u6210\u65b0\u7684\u5b57\u7b26\u4e32\u3002\n", - "\n", - "\u5e38\u7528\u4e8e\u8f93\u51fa\u6570\u636e\u5185\u5bb9\u3002" + } + ], + "source": [ + "import random\n", + "\n", + "number = random.randint(0, 99)\n", + "print('number:', number)\n", + "\n", + "low = 0\n", + "high = 100\n", + "running = True\n", + "\n", + "while running:\n", + " guess = int((low+high)/2)\n", + " print('guess:', guess)\n", + " if guess == number:\n", + " print('Congratulations, you guessed it.')\n", + " break\n", + " if guess < number:\n", + " print('No, it is a little higher than that.')\n", + " low = guess\n", + " continue\n", + " if guess> number:\n", + " print('No, it is a little lower than that.')\n", + " high = guess\n", + " continue\n", + "else:\n", + " print('The while loop is over.')\n", + "print('Done')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 练习\n", + "\n", + "说出下面代码的执行过程和输出结果:\n", + "\n", + " for i in range(12):\n", + " if i < 5:\n", + " continue\n", + " elif i> 9:\n", + " break\n", + " else:\n", + " print(i)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 答案" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "5\n", + "6\n", + "7\n", + "8\n", + "9\n" ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "name = 'shell'\n", - "\n", - "print('my name is {0} and the length of name is {1}'.format(name, len(name)))\n", - "print('my name is %s and the length of name is %d' % (name, len(name)))" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "my name is shell and the length of name is 5\n", - "my name is shell and the length of name is 5\n" - ] - } - ], - "prompt_number": 25 - }, + } + ], + "source": [ + "for i in range(12):\n", + " if i < 5:\n", + " continue\n", + " elif i> 9:\n", + " break\n", + " else:\n", + " print(i)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "# 函数" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 函数的定义和调用\n", + "\n", + "定义:" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": {}, + "outputs": [], + "source": [ + "def say_hello():\n", + " print('hello world')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "调用:" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7ec3\u4e60\n", - "\n", - "* \u7f16\u5199\u4e00\u884c\u4ee3\u7801\uff0c\u6253\u5370\u51fahello, world\u3002\n", - "* \u5047\u5b9a\u6709\u53d8\u91cfname\uff0c\u503c\u4e3a\u4f60\u7684\u540d\u5b57\u3002\u7f16\u5199\u4ee3\u7801\u6253\u5370\u51fahello, [your name]\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "hello world\n" ] - }, + } + ], + "source": [ + "say_hello()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 参数\n", + "\n", + "可以通过参数向函数传递数据。" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "slide" - } - }, - "source": [ - "# \u6267\u884c\u6d41\u63a7\u5236\n", - "\n", - "\u6267\u884c\u6d41\u63a7\u5236\u4ee3\u7801\u63a7\u5236\u6d41\u7684\u5148\u540e\u6267\u884c\u987a\u5e8f\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "4 is maximum\n" ] - }, + } + ], + "source": [ + "def print_max(a, b):\n", + " if a> b:\n", + " print('{0} is maximum'.format(a))\n", + " elif a == b:\n", + " print('{0} is equal to {1}'.format(a, b))\n", + " else:\n", + " print('{0} is maximum'.format(b))\n", + "print_max(3, 4)" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u903b\u8f91\u884c\u548c\u7269\u7406\u884c\n", - "\n", - "Python\u8bed\u53e5\u6267\u884c\u4ee5\u884c\u4e3a\u5355\u4f4d\u3002\u6bcf\u884c\u53ef\u9009\u7684\u53ef\u4ee5\u4ee5\u5206\u53f7;\u7ed3\u5c3e\u3002\n", - "\n", - "\u4f46\u662f\u7269\u7406\u4e0a\u7684\u4e00\u884c\u53ef\u4ee5\u5305\u542b\u591a\u4e2a\u6267\u884c\u5355\u4f4d\uff0c\u4f8b\u5982\uff1a" + "name": "stdout", + "output_type": "stream", + "text": [ + "exceptions\n" ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "i = 5; print(i);" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "5\n" - ] - } - ], - "prompt_number": 26 - }, + } + ], + "source": [ + "# python2.7下通过,python3下报错\n", + "try:\n", + " print_max(3, '4')\n", + " print_max('3', 4)\n", + "except:\n", + " print('exceptions')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "source": [ + "坑爹。print_max(3, '4')居然也能执行。说好的强类型呢?\n", + "\n", + "需要着重声明例子中的返回是违背常理的。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 局部变量\n", + "\n", + "在函数体内定义的变量称为局部变量。\n", + "\n", + "局部变量在函数执行时产生,在函数结束时消亡。函数外无法看到局部变量。\n", + "\n", + "参数可视为一种局部变量。\n", + "\n", + "对局部变量的修改不影响全局变量。" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "\u540c\u4e00\u4e2a\u6267\u884c\u5355\u4f4d\u4e5f\u53ef\u4ee5\u62c6\u5206\u4e3a\u591a\u884c\uff0c\u4f8b\u5982\uff1a" + "name": "stdout", + "output_type": "stream", + "text": [ + "Changed local x to 2\n", + "50\n" ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "print(\n", - "'Hello, world')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hello, world\n" - ] - } - ], - "prompt_number": 27 - }, + } + ], + "source": [ + "x = 50\n", + "def func():\n", + " x = 2\n", + " print('Changed local x to {0}'.format(x))\n", + "func()\n", + "print(x)" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u683c\u5f0f\u5bf9\u9f50\n", - "\n", - "Python\u4f7f\u7528\u5bf9\u9f50\u8868\u8fbe\u903b\u8f91\uff0c\u4f8b\u5982\uff1a" + "name": "stdout", + "output_type": "stream", + "text": [ + "Changed local x to 2\n", + "50\n" ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "a = 1\n", - "if a == 1:\n", - " print('ok')\n", - "print('done')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "ok\n", - "done\n" - ] - } - ], - "prompt_number": 28 - }, + } + ], + "source": [ + "x = 50\n", + "def func(x):\n", + " print('Changed local x to {0}'.format(x))\n", + "func(2)\n", + "print(x)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 全局变量\n", + "\n", + "在模块内定义的变量叫全局变量。\n", + "\n", + "全局变量在全局可见,函数体内可以引用全局变量。\n", + "\n", + "函数可以用global关键字声明某变量是全局的。" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "-" - } - }, - "source": [ - "\u5f53print(\u2018done\u2019)\u548cif\u5bf9\u9f50\u65f6\uff0c\u5fc5\u7136\u88ab\u6267\u884c\u3002\u800c\u548cprint(\u2018ok\u2019)\u5bf9\u9f50\u65f6\uff0c\u5728\u6761\u4ef6\u4e0b\u6267\u884c\u3002\n", - "\n", - "\u56e0\u6b64\u5bf9\u9f50\u4e0d\u5408\u9002\u7684\u4ee3\u7801\u4f1a\u5f15\u53d1\u8bed\u6cd5\u9519\u8bef\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "x is 50\n" ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "a = 0\n", - "if a == 1:\n", - " print('ok')\n", - "print('done')\n", - "\n", - "print('------')\n", - "\n", - "a = 1\n", - "if a == 1:\n", - " print('ok')\n", - "print('done')" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "done\n", - "------\n", - "ok\n", - "done\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "a = 0\n", - "if a == 1:\n", - " print('ok')\n", - " print('done')\n", - "\n", - "print('------')\n", - "\n", - "a = 1\n", - "if a == 1:\n", - " print('ok')\n", - " print('done')" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "------\n", - "ok\n", - "done\n" - ] - } - ], - "prompt_number": 30 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u5355\u884c\u5199\u6cd5" + } + ], + "source": [ + "x = 50\n", + "def func():\n", + " print('x is {0}'.format(x))\n", + "func()" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x is 50 before function.\n", + "x is 50\n", + "Changed x to 2\n", + "x is 2 after function.\n" ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "if True: print('ok')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "ok\n" - ] - } - ], - "prompt_number": 31 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## if" + } + ], + "source": [ + "x = 50\n", + "def func():\n", + " global x\n", + " print('x is {0}'.format(x))\n", + " x = 2\n", + " print('Changed x to {0}'.format(x))\n", + " \n", + "print('x is {0} before function.'.format(x))\n", + "func()\n", + "print('x is {0} after function.'.format(x))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 作用域\n", + "\n", + "变量可见的范围叫做变量的作用域。\n", + "\n", + "局部变量的作用域在函数内,全局变量的作用域在模块内(关于模块后文会讲)。\n", + "\n", + "作用域的基本原则是,内层作用域可访问外层作用域的变量,反之外层不可访问内层变量。\n", + "\n", + "如果两个作用域内有同一个名字,那么内层的起作用。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## Unbound异常\n", + "\n", + "python内的"local中有变量定义",是以local中存在对变量构建的语法(例如赋值)为标准的。\n", + "\n", + "这个构建语法所在行可能尚未执行(或永远无法执行到),但是这并不影响"local中有变量定义"这个事实。\n", + "\n", + "当local中定义了变量,但是变量尚未完成构建时,对变量做引用,会发生什么?" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ + { + "ename": "UnboundLocalError", + "evalue": "local variable 'x' referenced before assignment", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mUnboundLocalError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mx\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0mfunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m\u001b[0m in \u001b[0;36mfunc\u001b[0;34m()\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 5\u001b[0m \u001b[0mx\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mUnboundLocalError\u001b[0m: local variable 'x' referenced before assignment" ] - }, + } + ], + "source": [ + "x = 1\n", + "\n", + "def func():\n", + " print(x)\n", + " x = 2\n", + " \n", + "func()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 参数默认值\n", + "\n", + "函数定义时,可以给参数一个值。当调用时,该参数并未给出的情况下,使用默认值。\n", + "\n", + "提示:从安全性角度来说,不要使用可变对象作为参数默认值。" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": {}, + "outputs": [ { - "cell_type": "code", - "collapsed": false, - "input": [ - "# input\u662fpython3\u5199\u6cd5\uff0craw_input\u662f\u5bf9\u5e94\u7684python2\u5199\u6cd5\u3002\n", - "try:\n", - " input = raw_input\n", - "except NameError:\n", - " pass\n", - "\n", - "number = 23\n", - "\n", - "guess = int(input('Enter an integer : '))\n", - "if guess == number:\n", - " print('Congratulations, you guessed it.')\n", - " print('(but you do not win any prizes!)')\n", - "elif guess < number:\n", - " print('No, it is a little higher than that')\n", - "else:\n", - " print('No, it is a little lower than that')\n", - "print('Done')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter an integer : 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No, it is a little higher than that\n", - "Done\n" - ] - } - ], - "prompt_number": 32 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## while" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "try:\n", - " input = raw_input\n", - "except NameError:\n", - " pass\n", - "\n", - "number = 23\n", - "running = True\n", - "while running:\n", - " guess = int(input('Enter an integer : '))\n", - " if guess == number:\n", - " print('Congratulations, you guessed it.')\n", - " running = False\n", - " elif guess < number:\n", - " print('No, it is a little higher than that.')\n", - " else:\n", - " print('No, it is a little lower than that.')\n", - "else:\n", - " print('The while loop is over.')\n", - "print('Done')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter an integer : 10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No, it is a little higher than that.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter an integer : 30\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No, it is a little lower than that.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter an integer : 23\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Congratulations, you guessed it.\n", - "The while loop is over.\n", - "Done\n" - ] - } - ], - "prompt_number": 33 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## for" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "for i in range(1, 5):\n", - " print(i)\n", - "else:\n", - " print('The for loop is over')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n", - "2\n", - "3\n", - "4\n", - "The for loop is over\n" - ] - } - ], - "prompt_number": 34 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## break" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "try:\n", - " input = raw_input\n", - "except NameError:\n", - " pass\n", - "\n", - "while True:\n", - " s = input('Enter something : ')\n", - " if s == 'quit':\n", - " break\n", - " print('Length of the string is %d' % len(s))\n", - "print('Done')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter something : 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Length of the string is 1\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter something : quit\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Done\n" - ] - } - ], - "prompt_number": 35 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## continue" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "try:\n", - " input = raw_input\n", - "except NameError:\n", - " pass\n", - "\n", - "while True:\n", - " s = input('Enter something : ')\n", - " if s == 'quit':\n", - " break\n", - " if len(s) < 3:\n", - " print('Too small')\n", - " continue\n", - " print('Input is of sufficient length')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter something : 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Too small\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter something : 123\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Input is of sufficient length\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter something : quit\n" - ] - } - ], - "prompt_number": 36 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7ec3\u4e60\n", - "\n", - "\u8bf4\u51fa\u4e0b\u9762\u4ee3\u7801\u7684\u6267\u884c\u8fc7\u7a0b\u548c\u8f93\u51fa\u7ed3\u679c\uff1a\n", - "\n", - " for i in range(12):\n", - " if i < 5:\n", - " continue\n", - " elif i> 9:\n", - " break\n", - " else:\n", - " print(i)" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7b54\u6848" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "for i in range(12):\n", - " if i < 5:\n", - " continue\n", - " elif i> 9:\n", - " break\n", - " else:\n", - " print(i)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "5\n", - "6\n", - "7\n", - "8\n", - "9\n" - ] - } - ], - "prompt_number": 37 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "slide" - } - }, - "source": [ - "# \u51fd\u6570" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u51fd\u6570\u7684\u5b9a\u4e49\u548c\u8c03\u7528\n", - "\n", - "\u5b9a\u4e49\uff1a" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def say_hello():\n", - " print('hello world')" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 38 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "\u8c03\u7528\uff1a" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "say_hello()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "hello world\n" - ] - } - ], - "prompt_number": 39 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u53c2\u6570\n", - "\n", - "\u53ef\u4ee5\u901a\u8fc7\u53c2\u6570\u5411\u51fd\u6570\u4f20\u9012\u6570\u636e\u3002" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def print_max(a, b):\n", - " if a> b:\n", - " print('{0} is maximum'.format(a))\n", - " elif a == b:\n", - " print('{0} is equal to {1}'.format(a, b))\n", - " else:\n", - " print('{0} is maximum'.format(b))\n", - "print_max(3, 4)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "4 is maximum\n" - ] - } - ], - "prompt_number": 40 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# python2.7\u4e0b\u901a\u8fc7\uff0cpython3\u4e0b\u62a5\u9519\n", - "print_max(3, '4')\n", - "print_max('3', 4)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "4 is maximum\n", - "3 is maximum\n" - ] - } - ], - "prompt_number": 41 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "notes" - } - }, - "source": [ - "\u5751\u7239\u3002print_max(3, '4')\u5c45\u7136\u4e5f\u80fd\u6267\u884c\u3002\u8bf4\u597d\u7684\u5f3a\u7c7b\u578b\u5462\uff1f\n", - "\n", - "\u9700\u8981\u7740\u91cd\u58f0\u660e\u4f8b\u5b50\u4e2d\u7684\u8fd4\u56de\u662f\u8fdd\u80cc\u5e38\u7406\u7684\u3002" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u5c40\u90e8\u53d8\u91cf\n", - "\n", - "\u5728\u51fd\u6570\u4f53\u5185\u5b9a\u4e49\u7684\u53d8\u91cf\u79f0\u4e3a\u5c40\u90e8\u53d8\u91cf\u3002\n", - "\n", - "\u5c40\u90e8\u53d8\u91cf\u5728\u51fd\u6570\u6267\u884c\u65f6\u4ea7\u751f\uff0c\u5728\u51fd\u6570\u7ed3\u675f\u65f6\u6d88\u4ea1\u3002\u51fd\u6570\u5916\u65e0\u6cd5\u770b\u5230\u5c40\u90e8\u53d8\u91cf\u3002\n", - "\n", - "\u53c2\u6570\u53ef\u89c6\u4e3a\u4e00\u79cd\u5c40\u90e8\u53d8\u91cf\u3002\n", - "\n", - "\u5bf9\u5c40\u90e8\u53d8\u91cf\u7684\u4fee\u6539\u4e0d\u5f71\u54cd\u5168\u5c40\u53d8\u91cf\u3002" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "x = 50\n", - "def func():\n", - " x = 2\n", - " print('Changed local x to {0}'.format(x))\n", - "func()\n", - "print(x)" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Changed local x to 2\n", - "50\n" - ] - } - ], - "prompt_number": 42 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "x = 50\n", - "def func(x):\n", - " print('Changed local x to {0}'.format(x))\n", - "func(2)\n", - "print(x)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Changed local x to 2\n", - "50\n" - ] - } - ], - "prompt_number": 43 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u5168\u5c40\u53d8\u91cf\n", - "\n", - "\u5728\u6a21\u5757\u5185\u5b9a\u4e49\u7684\u53d8\u91cf\u53eb\u5168\u5c40\u53d8\u91cf\u3002\n", - "\n", - "\u5168\u5c40\u53d8\u91cf\u5728\u5168\u5c40\u53ef\u89c1\uff0c\u51fd\u6570\u4f53\u5185\u53ef\u4ee5\u5f15\u7528\u5168\u5c40\u53d8\u91cf\u3002\n", - "\n", - "\u51fd\u6570\u53ef\u4ee5\u7528global\u5173\u952e\u5b57\u58f0\u660e\u67d0\u53d8\u91cf\u662f\u5168\u5c40\u7684\u3002" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "x = 50\n", - "def func():\n", - " print('x is {0}'.format(x))\n", - "func()" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "x is 50\n" - ] - } - ], - "prompt_number": 44 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "x = 50\n", - "def func():\n", - " global x\n", - " print('x is {0}'.format(x))\n", - " x = 2\n", - " print('Changed x to {0}'.format(x))\n", - " \n", - "print('x is {0} before function.'.format(x))\n", - "func()\n", - "print('x is {0} after function.'.format(x))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "x is 50 before function.\n", - "x is 50\n", - "Changed x to 2\n", - "x is 2 after function.\n" - ] - } - ], - "prompt_number": 45 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u4f5c\u7528\u57df\n", - "\n", - "\u53d8\u91cf\u53ef\u89c1\u7684\u8303\u56f4\u53eb\u505a\u53d8\u91cf\u7684\u4f5c\u7528\u57df\u3002\n", - "\n", - "\u5c40\u90e8\u53d8\u91cf\u7684\u4f5c\u7528\u57df\u5728\u51fd\u6570\u5185\uff0c\u5168\u5c40\u53d8\u91cf\u7684\u4f5c\u7528\u57df\u5728\u6a21\u5757\u5185\uff08\u5173\u4e8e\u6a21\u5757\u540e\u6587\u4f1a\u8bb2\uff09\u3002\n", - "\n", - "\u4f5c\u7528\u57df\u7684\u57fa\u672c\u539f\u5219\u662f\uff0c\u5185\u5c42\u4f5c\u7528\u57df\u53ef\u8bbf\u95ee\u5916\u5c42\u4f5c\u7528\u57df\u7684\u53d8\u91cf\uff0c\u53cd\u4e4b\u5916\u5c42\u4e0d\u53ef\u8bbf\u95ee\u5185\u5c42\u53d8\u91cf\u3002\n", - "\n", - "\u5982\u679c\u4e24\u4e2a\u4f5c\u7528\u57df\u5185\u6709\u540c\u4e00\u4e2a\u540d\u5b57\uff0c\u90a3\u4e48\u5185\u5c42\u7684\u8d77\u4f5c\u7528\u3002" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## Unbound\u5f02\u5e38\n", - "\n", - "python\u5185\u7684\u201clocal\u4e2d\u6709\u53d8\u91cf\u5b9a\u4e49\u201d\uff0c\u662f\u4ee5local\u4e2d\u5b58\u5728\u5bf9\u53d8\u91cf\u6784\u5efa\u7684\u8bed\u6cd5\uff08\u4f8b\u5982\u8d4b\u503c\uff09\u4e3a\u6807\u51c6\u7684\u3002\n", - "\n", - "\u8fd9\u4e2a\u6784\u5efa\u8bed\u6cd5\u6240\u5728\u884c\u53ef\u80fd\u5c1a\u672a\u6267\u884c\uff08\u6216\u6c38\u8fdc\u65e0\u6cd5\u6267\u884c\u5230\uff09\uff0c\u4f46\u662f\u8fd9\u5e76\u4e0d\u5f71\u54cd\u201clocal\u4e2d\u6709\u53d8\u91cf\u5b9a\u4e49\u201d\u8fd9\u4e2a\u4e8b\u5b9e\u3002\n", - "\n", - "\u5f53local\u4e2d\u5b9a\u4e49\u4e86\u53d8\u91cf\uff0c\u4f46\u662f\u53d8\u91cf\u5c1a\u672a\u5b8c\u6210\u6784\u5efa\u65f6\uff0c\u5bf9\u53d8\u91cf\u505a\u5f15\u7528\uff0c\u4f1a\u53d1\u751f\u4ec0\u4e48\uff1f" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "x = 1\n", - "\n", - "def func():\n", - " print(x)\n", - " x = 2\n", - " \n", - "func()" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "ename": "UnboundLocalError", - "evalue": "local variable 'x' referenced before assignment", - "output_type": "pyerr", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mUnboundLocalError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mx\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0mfunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m\u001b[0m in \u001b[0;36mfunc\u001b[0;34m()\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0;32mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 5\u001b[0m \u001b[0mx\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mUnboundLocalError\u001b[0m: local variable 'x' referenced before assignment" - ] - } - ], - "prompt_number": 46 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u53c2\u6570\u9ed8\u8ba4\u503c\n", - "\n", - "\u51fd\u6570\u5b9a\u4e49\u65f6\uff0c\u53ef\u4ee5\u7ed9\u53c2\u6570\u4e00\u4e2a\u503c\u3002\u5f53\u8c03\u7528\u65f6\uff0c\u8be5\u53c2\u6570\u5e76\u672a\u7ed9\u51fa\u7684\u60c5\u51b5\u4e0b\uff0c\u4f7f\u7528\u9ed8\u8ba4\u503c\u3002\n", - "\n", - "\u63d0\u793a\uff1a\u4ece\u5b89\u5168\u6027\u89d2\u5ea6\u6765\u8bf4\uff0c\u4e0d\u8981\u4f7f\u7528\u53ef\u53d8\u5bf9\u8c61\u4f5c\u4e3a\u53c2\u6570\u9ed8\u8ba4\u503c\u3002" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def say(message, times=1):\n", - " print(message * times)\n", - "\n", - "say('Hello')\n", - "say('World', 5)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hello\n", - "WorldWorldWorldWorldWorld\n" - ] - } - ], - "prompt_number": 47 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def append1(l=[]):\n", - " l.append(1)\n", - " return l\n", - "\n", - "print(append1([]))\n", - "print(append1([]))\n", - "\n", - "print('------')\n", - "\n", - "print(append1())\n", - "print(append1())" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "[1]\n", - "[1]\n", - "------\n", - "[1]\n", - "[1, 1]\n" - ] - } - ], - "prompt_number": 48 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "\u9047\u5230\u5e0c\u671b\u4f7f\u7528\u53ef\u53d8\u5bf9\u8c61\u4f5c\u4e3a\u53c2\u6570\u9ed8\u8ba4\u503c\u7684\u60c5\u51b5\uff0c\u9700\u8981\u4f7f\u7528None\u4f5c\u4e3a\u9ed8\u8ba4\u503c\u3002\n", - "\n", - "\u5728\u51fd\u6570\u4e2d\u5224\u65ad\u662f\u5426\u4e3aNone\uff0c\u662f\u7684\u8bdd\u518d\u5bf9\u53c2\u6570\u505a\u9ed8\u8ba4\u503c\u8d4b\u503c\u5904\u7406\u3002\n", - "\n", - "\u4ee5\u6b64\u6a21\u5f0f\u6765\u907f\u514d\u4e0a\u8ff0\u95ee\u9898\u3002" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def append1(l=None):\n", - " if l is None:\n", - " l = []\n", - " l.append(1)\n", - " return l\n", - "\n", - "print(append1([]))\n", - "print(append1([]))\n", - "\n", - "print('------')\n", - "\n", - "print(append1())\n", - "print(append1())" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "[1]\n", - "[1]\n", - "------\n", - "[1]\n", - "[1]\n" - ] - } - ], - "prompt_number": 49 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u8fd4\u56de\u503c\n", - "\n", - "\u5c06\u51fd\u6570\u5185\u6570\u636e\u4f20\u9012\u56de\u53bb\u3002" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def maximum(x, y):\n", - " if x> y:\n", - " return x\n", - " elif x == y:\n", - " return 'The numbers are equal'\n", - " else:\n", - " return y\n", - "\n", - "print(maximum(2, 3))\n", - "print(maximum(2, 2))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n", - "The numbers are equal\n" - ] - } - ], - "prompt_number": 50 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u591a\u503c\u8fd4\u56de\n", - "\n", - "Python\u5141\u8bb8\u4e00\u6b21\u8fd4\u56de\u591a\u4e2a\u503c\u3002\n", - "\n", - "\u591a\u503c\u8fd4\u56de\u7684\u672c\u8d28\u662f\u4f7f\u7528tuple\u4e2d\u8f6c\uff08\u540e\u9762\u8be6\u7ec6\u8bb2\u89e3\uff09\u3002" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "notes" - } - }, - "source": [ - "\u63d0\u524d\u5f3a\u8c03\u201c\u6700\u5c0f\u60ca\u8bb6\u539f\u5219\u201d\u3002" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def f():\n", - " return 1,2,3,4,5\n", - "print (f())\n", - "\n", - "a,b,c,d,e = f()\n", - "print(c)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(1, 2, 3, 4, 5)\n", - "3\n" - ] - } - ], - "prompt_number": 51 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## Doc String\n", - "\n", - "Python\u5141\u8bb8\u4e3a\u6bcf\u4e2a\u51fd\u6570\u589e\u52a0\u4e00\u4e2a\u6587\u6863\u5b57\u7b26\u4e32\uff0c\u8fd9\u4e2a\u6587\u6863\u5b57\u7b26\u4e32\u53ef\u4ee5\u88ab\u4ee3\u7801\u8bbf\u95ee\u3002\n", - "\n", - "\u5177\u4f53\u65b9\u5f0f\u662f\uff0c\u5728\u51fd\u6570\u7684\u7b2c\u4e00\u4e2a\u903b\u8f91\u884c\u5b9a\u4e49\u4e00\u4e2a\u5b57\u7b26\u4e32\uff08\u4e0d\u6267\u884c\u4efb\u4f55\u64cd\u4f5c\uff09\u3002\n", - "\n", - "\u8bbf\u95ee\u65b9\u5f0f\u662ffunction.\\_\\_doc\\_\\_\u3002" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "notes" - } - }, - "source": [ - "\u8bb2\u89e3doc string\u5728\u6587\u6863\u91cc\u7684\u4f5c\u7528\uff0c\u5bf9\u6bd4java doc\u3002" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def print_max(x, y):\n", - " '''Prints the maximum of two numbers. \\nThe two values must be integers.'''\n", - " x = int(x)\n", - " y = int(y)\n", - " if x> y:\n", - " print('{} is maximum'.format(x))\n", - " else:\n", - " print('{} is maximum'.format(y))\n", - "\n", - "print_max(3, 5)\n", - "print(print_max.__doc__)" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "5 is maximum\n", - "Prints the maximum of two numbers. \n", - "The two values must be integers.\n" - ] - } - ], - "prompt_number": 52 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## lambda\n", - "\n", - "\u4e00\u79cd\u5feb\u901f\u5b9a\u4e49\u7b80\u5355\u51fd\u6570\u7684\u65b9\u6cd5\u3002" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def inc(n):\n", - " return n+1\n", - "print(inc(10))\n", - "\n", - "inc = lambda n: n+1\n", - "print(inc(10))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "11\n", - "11\n" - ] - } - ], - "prompt_number": 53 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7ec3\u4e60\n", - "\n", - "\u5b9a\u4e49fib\u51fd\u6570\u3002\n", - "\n", - "\u8f93\u5165n\uff0cfib\u7684\u8f93\u51fa\u4e3a\u6570\u5217\u7b2cn\u9879\u7684\u503c\u3002\n", - "\n", - "\u6570\u5217\u67d0\u9879\u7b49\u4e8e\u524d\u4e24\u9879\u4e4b\u548c\u3002" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "notes" - } - }, - "source": [ - "\u53ef\u6f14\u793a\u9012\u5f52\u548c\u5faa\u73af\u7b97\u6cd5\uff0c\u6bd4\u8f83\u5176\u7279\u6027\u3002\u8bf4\u660e\u7b80\u6d01\u548c\u5feb\u901f\u7684\u77db\u76fe\u3002\n", - "\n", - "\u53ef\u4ee5\u5728\u6700\u540e\u4f7f\u7528for\u5faa\u73af\u6253\u5370\u8f93\u51fa\uff0c\u4e3a\u540e\u9762\u201c\\_\\_main\\_\\_\u6807\u51c6\u5199\u6cd5\u201d\u6253\u57fa\u7840\u3002" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7b54\u6848" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def fib(n):\n", - " if n <= 1: return 1\n", - " return fib(n-1) + fib(n-2)\n", - "\n", - "fib(10)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 54, - "text": [ - "89" - ] - } - ], - "prompt_number": 54 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "slide" - } - }, - "source": [ - "# \u6a21\u5757" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## Module\n", - "\n", - "\u9884\u5148\u5199\u597d\u7684\u4ee3\u7801\uff0c\u4f9b\u5176\u4ed6\u4ee3\u7801\u4f7f\u7528\u3002\n", - "\n", - "\u4e00\u4e2amodule\u662f\u4e00\u4e2a\u72ec\u7acb\u6587\u4ef6\u3002\n", - "\n", - "\u6bcf\u4e2amodule\u62e5\u6709\u81ea\u5df1\u7684\u5168\u5c40\u53d8\u91cf\u7a7a\u95f4\u3002\u6570\u636e\u5b9a\u4e49\uff0c\u51fd\u6570\uff0c\u5747\u5b9a\u4e49\u5728\u5176\u4e2d\u3002" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "%%writefile testmod.py\n", - "varible1 = 1\n", - "varible2 = 2\n", - "\n", - "def add(a, b):\n", - " return a+b\n", - "\n", - "if __name__ == '__main__':\n", - " print('run as script')" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Writing testmod.py\n" - ] - } - ], - "prompt_number": 55 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "!ls -l testmod.py" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "-rw-r--r-- 1 shell shell 111 10\u6708 28 20:06 testmod.py\r\n" - ] - } - ], - "prompt_number": 56 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Windows\u4e0b\u8981\u7528dir testmod.py" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## import\n", - "\n", - "import\u5f15\u5165\u67d0\u4e2amodule\u5bf9\u8c61\uff0c\u53ef\u4f7f\u7528module.name\u7684\u65b9\u5f0f\u5f15\u7528\u5b83\u7684\u5168\u5c40\u53d8\u91cf\u3002" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import testmod\n", - "testmod.varible1" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 57, - "text": [ - "1" - ] - } - ], - "prompt_number": 57 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## from import\n", - "\n", - "from import\u5f15\u5165\u6a21\u5757\u4e2d\u7684\u67d0\u4e2a\uff08\u6216\u5168\u90e8\uff09\u53d8\u91cf\u3002\n", - "\n", - "\u88ab\u5f15\u5165\u53d8\u91cf\u4e0d\u9700\u8981module.name\u6765\u8bbf\u95ee\uff0c\u4ec5\u9700\u8981name\u3002\n", - "\n", - "\u6ce8\u610f\uff1a\u4e0d\u63a8\u8350\u5f15\u5165\u5168\u90e8\u53d8\u91cf\uff0c\u4f1a\u5f15\u8d77\u540d\u79f0\u7a7a\u95f4\u6c61\u67d3\u3002" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from testmod import varible2\n", - "varible2" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 58, - "text": [ - "2" - ] - } - ], - "prompt_number": 58 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## dir\n", - "\n", - "\u5217\u51fa\u67d0\u4e2a\u6a21\u5757\u7684\u6240\u6709\u53d8\u91cf\u3002" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import testmod\n", - "dir(testmod)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 59, - "text": [ - "['__builtins__',\n", - " '__doc__',\n", - " '__file__',\n", - " '__name__',\n", - " '__package__',\n", - " 'add',\n", - " 'varible1',\n", - " 'varible2']" - ] - } - ], - "prompt_number": 59 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u6a21\u5757\u9884\u7f16\u8bd1\n", - "\n", - "\u5f53import\u65f6\uff0cpython\u4f1a\u8bd5\u56fe\u53bb\u7f16\u8bd1\u51fapyc\u6587\u4ef6\u6765\u3002\n", - "\n", - "pyc\u662f\u88ab\u7f16\u8bd1\u8fc7\u7684py\u6587\u4ef6\uff0c\u52a0\u8f7dpyc\u6587\u4ef6\u53ef\u4ee5\u8df3\u8fc7\u8bed\u6cd5\u89e3\u6790\u8fc7\u7a0b\u3002\n", - "\n", - "\u5f53py\u65e5\u671f\u65b0\u4e8epyc\u65f6\uff0c\u91cd\u65b0\u751f\u6210pyc\u3002\u6240\u4ee5\u65e5\u671f\u7d0a\u4e71\u53ef\u80fd\u5bfc\u81f4\u6267\u884c\u8001\u4ee3\u7801\u3002\n", - "\n", - "\u5728Python3(3.2\u4ee5\u540e)\u4e2d\uff0c\u4f1a\u5728\u5f53\u524d\u76ee\u5f55\u4e0b\u751f\u6210\\_\\_pycache\\_\\_\u76ee\u5f55\uff0c\u6765\u7f13\u5b58pyc\u6587\u4ef6\u3002\n", - "\n", - "\u8fd9\u6837\u53ef\u4ee5\u907f\u514d\u591a\u4e2aPython\u89e3\u91ca\u5668\u65e0\u6cd5\u4e92\u76f8\u8f7d\u5165\u5bf9\u65b9\u7684pyc\u6587\u4ef6\u3002\n", - "\n", - "\u5177\u4f53\u53ef\u4ee5\u53c2\u8003\u8fd9\u91cc\uff1a https://docs.python.org/3/whatsnew/3.2.html " - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "notes" - } - }, - "source": [ - "\u6ce8\u610f\u52a0\u8f7d\u987a\u5e8f\u5bfc\u81f4\u5f53\u524d\u76ee\u5f55\u6a21\u5757\u540d\u548c\u7cfb\u7edf\u76f8\u540c\u65f6\u4f1a\u53d1\u751f\u8986\u76d6\u95ee\u9898\u3002\n", - "\n", - "\u540c\u65f6\u6ce8\u610f\u8fd9\u4e2a\u73b0\u8c61\u53d7\u5236\u4e8e\u7cfb\u7edf\u5e93\u662f\u5426\u5df2\u7ecf\u8f7d\u5165\uff0c\u4ece\u800c\u5f15\u51fa\u7cfb\u7edf\u5e93\u4e0d\u4f1a\u591a\u6b21\u201c\u52a0\u8f7d\u201d\u7684\u7ed3\u8bba\u3002" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "!ls -l testmod*" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "-rw-r--r-- 1 shell shell 111 10\u6708 28 20:06 testmod.py\r\n", - "-rw-r--r-- 1 shell shell 333 10\u6708 28 20:06 testmod.pyc\r\n" - ] - } - ], - "prompt_number": 60 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "!ls -l __pycache__/testmod*" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "-rw-r--r-- 1 shell shell 356 10\u6708 28 19:58 __pycache__/testmod.cpython-35.pyc\r\n" - ] - } - ], - "prompt_number": 61 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "\u7531\u4e8e\u8fd9\u4e2a\u7cfb\u7edf\u4f7f\u7528\u4e86python2\u4f5c\u4e3a\u57fa\u7840\uff0c\u56e0\u6b64\u6ca1\u6709\\_\\_pycache\\_\\_\u3002" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \\_\\_name\\_\\_\u5c5e\u6027\n", - "\n", - "\u6a21\u5757\u6709\u4e00\u4e2a\u5c5e\u6027\uff0c\\_\\_name\\_\\_\u3002\u5f53\u8fd9\u4e2a\u5c5e\u6027\u4e3a'\\_\\_main\\_\\_'\u65f6\uff0c\u8bf4\u660e\u5f53\u524d\u6a21\u5757\u88ab\u4f5c\u4e3a\u811a\u672c\u8fd0\u884c\u3002\n", - "\n", - "\u6a21\u5757\u88ab\u4f5c\u4e3a\u4ee5\u811a\u672c\u8fd0\u884c\u65f6\uff0c\u4e0d\u751f\u6210pyc\u6587\u4ef6\uff08\u56e0\u4e3a\u4e0d\u662fimport\uff09\u3002" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "__name__" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 62, - "text": [ - "'__main__'" - ] - } - ], - "prompt_number": 62 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "testmod.__name__" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 63, - "text": [ - "'testmod'" - ] - } - ], - "prompt_number": 63 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## Main\u6587\u4ef6\u6a21\u5f0f\u5316\u5199\u6cd5" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "!tail -n 2 testmod.py" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "if __name__ == '__main__':\r\n", - " print('run as script')" - ] - } - ], - "prompt_number": 64 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "!python testmod.py" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "run as script\r\n" - ] - } - ], - "prompt_number": 65 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "!rm testmod*" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "skip" - } - }, - "outputs": [], - "prompt_number": 66 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## Package\n", - "\n", - "\u4ece\u7ec4\u7ec7\u7ed3\u6784\u4e0a\u8bf4\uff0cpackage\u662f\u6bd4modules\u66f4\u5927\u4e00\u7ea7\u7684\u7ed3\u6784\u3002\n", - "\n", - "\u4e00\u4e2apackage\u91cc\u53ef\u4ee5\u5305\u542b\u591a\u4e2amodules\u548cpackages\u3002\n", - "\n", - "\u4e00\u822c\u4e00\u4e2apackage\u662f\u4e00\u4e2a\u72ec\u7acb\u76ee\u5f55\uff0c\u91cc\u9762\u6709\\_\\_init\\_\\_.py\u6587\u4ef6\u3002\n", - "\n", - "\u8fd9\u4e2a\u6587\u4ef6\u6307\u660e\u4e86\u5982\u4f55\u52a0\u8f7d\u6574\u4e2apackage\u3002" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "notes" - } - }, - "source": [ - "\u53ef\u4ee5\u627e\u4e00\u4e9b\u5b9e\u9645\u7684\u6587\u4ef6\u5e03\u5c40\u7684\u4f8b\u5b50\u3002" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7ec3\u4e60\n", - "\n", - "* \u5bfc\u5165\u7cfb\u7edfsys\u6a21\u5757\n", - "* \u5217\u51fasys\u6a21\u5757\u4e2d\u4ee5s\u5f00\u5934\u5e76\u4e14\u4ee5e\u7ed3\u5c3e\u7684\u6210\u5458\u3002" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "notes" - } - }, - "source": [ - "\u6b64\u5904\u9700\u8981\u63d0\u524d\u8bf4\u660estartswith\u548cendswith\u7684\u7528\u6cd5\u3002" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7b54\u6848" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "for name in dir(sys):\n", - " if name.startswith('s') and name.endswith('e'):\n", - " print(name)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "setprofile\n", - "settrace\n" - ] - } - ], - "prompt_number": 67 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "slide" - } - }, - "source": [ - "# \u5185\u7f6e\u6570\u636e\u7ed3\u6784\n", - "\n", - "* list\n", - "* tuple\n", - "* dict\n", - "* set\n", - "* string" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## list\n", - "\n", - "\u5177\u6709\u987a\u5e8f\u7684\u4e00\u7ec4\u5bf9\u8c61\u3002\n", - "\n", - "\u53ef\u4ee5\u968f\u610f\u8bbf\u95ee\u5176\u4e2d\u7684\u4efb\u610f\u4f4d\u7f6e\u3002\n", - "\n", - "\u53ef\u4ee5\u6dfb\u52a0\u548c\u5220\u9664\u3002\n", - "\n", - "\u5176\u4e2d\u7684\u5143\u7d20\u4e0d\u9700\u8981\u662f\u540c\u7c7b\u578b\u3002" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "notes" - } - }, - "source": [ - "\u539f\u4e66\u4f8b\u5b50\u6709\u95ee\u9898\uff0c\u90a3\u662fpython3\u7684\u4ee3\u7801\u3002" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "shoplist = ['apple', 'mango', 'carrot', 'banana']\n", - "\n", - "print('I have {} items to purchase.'.format(len(shoplist)))\n", - "sys.stdout.write('These items are: ')\n", - "for item in shoplist:\n", - " sys.stdout.write(str(item) + ' ')\n", - "\n", - "print('\\nI also have to buy rice.')\n", - "shoplist.append('rice')\n", - "print('My shopping list is now {0}'.format(shoplist))\n", - "\n", - "print('I will sort my list now')\n", - "shoplist.sort()\n", - "print('Sorted shopping list is {0}'.format(shoplist))\n", - "\n", - "print('The first item I will buy is {0}'.format(shoplist[0]))\n", - "olditem = shoplist[0]\n", - "del shoplist[0]\n", - "print('I bought the {0}'.format(olditem))\n", - "print('My shopping list is now {0}'.format(shoplist))" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "I have 4 items to purchase.\n", - "These items are: apple mango carrot banana \n", - "I also have to buy rice.\n", - "My shopping list is now ['apple', 'mango', 'carrot', 'banana', 'rice']\n", - "I will sort my list now\n", - "Sorted shopping list is ['apple', 'banana', 'carrot', 'mango', 'rice']\n", - "The first item I will buy is apple\n", - "I bought the apple\n", - "My shopping list is now ['banana', 'carrot', 'mango', 'rice']\n" - ] - } - ], - "prompt_number": 68 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## tuple\n", - "\n", - "\u5177\u6709\u987a\u5e8f\u7684\u4e00\u7ec4\u5bf9\u8c61\u3002\n", - "\n", - "\u53ef\u4ee5\u968f\u610f\u8bbf\u95ee\u5176\u4e2d\u7684\u4efb\u610f\u4f4d\u7f6e\u3002\n", - "\n", - "\u4e0d\u53ef\u4ee5\u6dfb\u52a0\u548c\u5220\u9664\u3002\n", - "\n", - "\u5176\u4e2d\u7684\u5143\u7d20\u4e0d\u9700\u8981\u662f\u540c\u7c7b\u578b\u3002" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "zoo = ('python', 'elephant', 'penguin')\n", - "print('Number of animals in the zoo is {0}'.format(len(zoo)))\n", - "\n", - "new_zoo = 'monkey', 'camel', zoo\n", - "print('Number of cages in the new zoo is {0}'.format(len(new_zoo)))\n", - "\n", - "print('All animals in new zoo are {0}'.format(new_zoo))\n", - "print('Animals brought from old zoo are {0}'.format(new_zoo[2]))\n", - "print('Last animal brought from old zoo is {0}'.format(new_zoo[2][2]))\n", - "print('Number of animals in the new zoo is {0}'.format(len(new_zoo)-1+len(new_zoo[2])))" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number of animals in the zoo is 3\n", - "Number of cages in the new zoo is 3\n", - "All animals in new zoo are ('monkey', 'camel', ('python', 'elephant', 'penguin'))\n", - "Animals brought from old zoo are ('python', 'elephant', 'penguin')\n", - "Last animal brought from old zoo is penguin\n", - "Number of animals in the new zoo is 5\n" - ] - } - ], - "prompt_number": 69 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "r = 1, 2, 3\n", - "r" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 70, - "text": [ - "(1, 2, 3)" - ] - } - ], - "prompt_number": 70 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "a, b, c = r\n", - "print(a)\n", - "print(b)\n", - "print(c)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n", - "2\n", - "3\n" - ] - } - ], - "prompt_number": 71 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "a, b = b, a\n", - "print(a)\n", - "print(b)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "2\n", - "1\n" - ] - } - ], - "prompt_number": 72 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u64cd\u4f5c\u5e8f\u5217\u5bf9\u8c61\n", - "\n", - "* \u901a\u8fc7[]\u8bbf\u95ee\n", - "* \u901a\u8fc7[]\u8bbe\u5b9a\u503c\n", - "* \u901a\u8fc7for\u679a\u4e3e\n", - "* \u901a\u8fc7[:]\u8bbf\u95ee\n", - "* \u901a\u8fc7[:]\u8bbe\u5b9a\u503c\n", - "* \u901a\u8fc7[::]\u8bbe\u5b9a\u6b65\u8fdb" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "shoplist = ['apple', 'mango', 'carrot', 'banana']\n", - "name = 'swaroop'\n", - "print('Item 0 is {0}'.format(shoplist[0]))\n", - "print('Item 1 is {0}'.format(shoplist[1]))\n", - "print('Item 2 is {0}'.format(shoplist[2]))\n", - "print('Item 3 is {0}'.format(shoplist[3]))\n", - "print('Item -1 is {0}'.format(shoplist[-1]))\n", - "print('Item -2 is {0}'.format(shoplist[-2]))\n", - "print('Character 0 is {0}'.format(name[0]))\n", - "\n", - "print('Item 1 to 3 is {0}'.format(shoplist[1:3]))\n", - "print('Item 2 to end is {0}'.format(shoplist[2:]))\n", - "print('Item 1 to -1 is {0}'.format(shoplist[1:-1]))\n", - "print('Item start to end is {0}'.format(shoplist[:]))\n", - "print('characters 1 to 3 is {0}'.format(name[1:3]))\n", - "print('characters 2 to end is {0}'.format(name[2:]))\n", - "print('characters 1 to -1 is {0}'.format(name[1:-1]))\n", - "print('characters start to end is {0}'.format(name[:]))\n", - "print('reversed characters is {0}'.format(name[::-1]))" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Item 0 is apple\n", - "Item 1 is mango\n", - "Item 2 is carrot\n", - "Item 3 is banana\n", - "Item -1 is banana\n", - "Item -2 is carrot\n", - "Character 0 is s\n", - "Item 1 to 3 is ['mango', 'carrot']\n", - "Item 2 to end is ['carrot', 'banana']\n", - "Item 1 to -1 is ['mango', 'carrot']\n", - "Item start to end is ['apple', 'mango', 'carrot', 'banana']\n", - "characters 1 to 3 is wa\n", - "characters 2 to end is aroop\n", - "characters 1 to -1 is waroo\n", - "characters start to end is swaroop\n", - "reversed characters is pooraws\n" - ] - } - ], - "prompt_number": 73 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7ec3\u4e60\n", - "\n", - "1. \u5efa\u7acb\u4e00\u4e2alist\uff0c\u5185\u5bb9\u4e3a10\u4ee5\u5185\u7684\u6240\u6709\u8d28\u6570\u3002\n", - "2. \u8ba1\u7b97\u51fa100\u5185\u6240\u6709\u8d28\u6570\u7684\u5217\u8868\u3002\n", - "3. \u5c06\u8fd9\u4e2a\u5217\u8868\u8f6c\u4e3atuple\u3002\n", - "4. \u6839\u636e\u4e0a\u9762\u7684tuple\uff0c\u83b7\u5f97\u53cd\u8f6c\u7684tuple\u3002\n", - "5. \u5c06\u4e00\u4e2alist\u5206\u4e3a\u4e24\u4e2a\uff1a\u7b2c\u4e00\u4e2alist\u62e5\u6709\u539f\u672clist\u524d\u4e00\u534a\u7684\u53cd\u5411\uff0c\u7b2c\u4e8c\u4e2alist\u62e5\u6709\u539f\u672clist\u540e\u4e00\u534a\u7684\u53cd\u5411\u3002" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "notes" - } - }, - "source": [ - "\u57c3\u62c9\u6258\u65af\u7279\u5c3c\u7b5b\u6cd5\u3002\u6ce8\u610f\u4ee3\u7801\u5b9e\u73b0\u4e2d\u7684\u7b5b\u6cd5\u6548\u7387\u662f\u6709\u95ee\u9898\u7684\u3002\u4e3b\u8981\u56e0\u4e3asqrt\u51fd\u6570\u6ca1\u6559\u8fc7\u3002" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7b54\u6848" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "primes = [2, 3, 5, 7]\n", - "primes" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 74, - "text": [ - "[2, 3, 5, 7]" - ] - } - ], - "prompt_number": 74 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "for i in range(10, 100):\n", - " prime = True\n", - " for j in primes:\n", - " if i % j == 0:\n", - " prime = False\n", - " break\n", - " if prime:\n", - " primes.append(i)\n", - "print(primes)" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]\n" - ] - } - ], - "prompt_number": 75 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "tuple_primes = tuple(primes)\n", - "print(tuple_primes)" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97)\n" - ] - } - ], - "prompt_number": 76 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "print(tuple_primes[::-1])" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(97, 89, 83, 79, 73, 71, 67, 61, 59, 53, 47, 43, 41, 37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2)\n" - ] - } - ], - "prompt_number": 77 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "print(tuple(reversed(tuple_primes)))" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "-" - } - }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(97, 89, 83, 79, 73, 71, 67, 61, 59, 53, 47, 43, 41, 37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2)\n" - ] - } - ], - "prompt_number": 78 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Python2\u4e0b\u53ef\u4ee5\u4e0d\u9700\u8981int\uff0c\u56e0\u4e3alen\u7ed3\u679c\u662f\u6574\u6570\uff0c\u6574\u6570\u9664\u6cd5\u7ed3\u679c\u662f\u6574\u6570\u3002\n", - "# \u5728Python3\uff0c\u6ca1\u6709int\u4f1a\u5bfc\u81f4\u51fa\u9519\u3002\n", - "list(reversed(primes[:int(len(primes)/2)])), list(reversed(primes[int(len(primes)/2):]))" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 79, - "text": [ - "([37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2],\n", - " [97, 89, 83, 79, 73, 71, 67, 61, 59, 53, 47, 43, 41])" - ] - } - ], - "prompt_number": 79 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "primes[int(len(primes)/2-1)::-1], primes[:int(len(primes)/2-1):-1]" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 80, - "text": [ - "([37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2],\n", - " [97, 89, 83, 79, 73, 71, 67, 61, 59, 53, 47, 43, 41])" - ] - } - ], - "prompt_number": 80 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u5217\u8868\u63a8\u5bfc\u5f0f" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "l = range(12)\n", - "t = [i * i for i in l]\n", - "print(t)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "[0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121]\n" - ] - } - ], - "prompt_number": 81 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "t = [i * i for i in l if i % 2 != 0]\n", - "print(t)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "[1, 9, 25, 49, 81, 121]\n" - ] - } - ], - "prompt_number": 82 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7ec3\u4e60\n", - "\n", - "\u601d\u8003\u4e00\u4e0b\uff0c\u5217\u8868\u63a8\u5bfc\u5f0f\u662f\u5426\u80fd\u591f\u5c06\u7d20\u6570\u5217\u8868\u76f4\u63a5\u5b9e\u73b0\u51fa\u6765\uff1f\u4e3a\u4ec0\u4e48\uff1f\n", - "\n", - "\u7136\u540e\u81ea\u5df1\u6d4b\u8bd5\u4e00\u4e0b\u3002" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "notes" - } - }, - "source": [ - "\u95ee\u9898\u7684\u5173\u952e\u5728\u4e8e\u201c\u751f\u6210\u5217\u8868\u7684\u65f6\u5019\u5217\u8868\u662f\u7a7a\u7684\u201d\u3002\u6240\u4ee5\u4e0d\u80fd\u4e00\u6b21\u6027\u751f\u6210\uff0c\u5fc5\u987b\u6e10\u8fdb\u3002" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## dict\n", - "\n", - "\u5177\u6709\u4e00\u7cfb\u5217\u6210\u5bf9\u5bf9\u8c61\u3002\u4e00\u4e2a\u53eb\u505akey\uff0c\u4e00\u4e2a\u53eb\u505avalue\u3002\n", - "\n", - "\u65e0\u987a\u5e8f\uff0ckey\u4e0d\u53ef\u91cd\u590d\u3002\n", - "\n", - "\u901a\u8fc7\u5176\u4e2d\u4e00\u4e2a(key)\u53ef\u4ee5\u552f\u4e00\u786e\u5b9a\u53e6\u5916\u4e00\u4e2a(value)\uff0c\u53cd\u4e4b\u672a\u5fc5\u3002\n", - "\n", - "\u53ef\u4ee5\u6dfb\u52a0\u548c\u5220\u9664\u3002\n", - "\n", - "\u5176\u4e2d\u7684\u5143\u7d20(\u5305\u62eckey\u548cvalue)\u4e0d\u9700\u8981\u662f\u540c\u7c7b\u578b\u3002\n", - "\n", - "key\u5fc5\u987b\u662f\u4e0d\u53ef\u53d8\u5bf9\u8c61\u3002" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "ab = {\n", - " 'Swaroop': 'swaroop@swaroopch.com',\n", - " 'Larry': 'larry@wall.org',\n", - " 'Matsumoto': 'matz@ruby-lang.org',\n", - " 'Spammer': 'spammer@hotmail.com'\n", - "}\n", - "\n", - "print(\"Swaroop's address is {}\".format(ab['Swaroop']))\n", - "del ab['Spammer']\n", - "\n", - "print('There are {} contacts in the address-book'.format(len(ab)))\n", - "print('Name list: %s' % ', '.join(ab))\n", - "for name, address in ab.items():\n", - " print('Contact {} at {}'.format(name, address))\n", - "\n", - "ab['Guido'] = 'guido@python.org'\n", - "if 'Guido' in ab:\n", - " print(\"Guido's address is {}\".format(ab['Guido']))" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Swaroop's address is swaroop@swaroopch.com\n", - "There are 3 contacts in the address-book\n", - "Name list: Swaroop, Matsumoto, Larry\n", - "Contact Swaroop at swaroop@swaroopch.com\n", - "Contact Matsumoto at matz@ruby-lang.org\n", - "Contact Larry at larry@wall.org\n", - "Guido's address is guido@python.org\n" - ] - } - ], - "prompt_number": 83 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## set\n", - "\n", - "\u5177\u6709\u4e00\u7ec4\u5bf9\u8c61\u3002\u65e0\u987a\u5e8f\uff0c\u4e0d\u53ef\u91cd\u590d\u3002\n", - "\n", - "\u53ef\u4ee5\u6dfb\u52a0\u548c\u5220\u9664\u3002\n", - "\n", - "\u5176\u4e2d\u7684\u5143\u7d20\u4e0d\u9700\u8981\u662f\u540c\u7c7b\u578b\uff0c\u4f46\u5fc5\u987b\u662f\u4e0d\u53ef\u53d8\u5bf9\u8c61\u3002" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "bri = set(['brazil', 'russia', 'india'])\n", - "bri = {'brazil', 'russia', 'india'} # python2.7\u4ee5\u540e\u53ef\u7528\n", - "'india' in bri" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 84, - "text": [ - "True" - ] - } - ], - "prompt_number": 84 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "'usa' in bri" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 85, - "text": [ - "False" - ] - } - ], - "prompt_number": 85 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "bric = bri.copy()\n", - "bric.add('china')\n", - "print(bric)\n", - "bric.issuperset(bri)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "set(['brazil', 'china', 'india', 'russia'])\n" - ] - }, - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 86, - "text": [ - "True" - ] - } - ], - "prompt_number": 86 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "bric.remove('russia')\n", - "print(bric)\n", - "bri & bric" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "set(['brazil', 'china', 'india'])\n" - ] - }, - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 87, - "text": [ - "{'brazil', 'india'}" - ] - } - ], - "prompt_number": 87 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "bri | bric" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "metadata": {}, - "output_type": "pyout", - "prompt_number": 88, - "text": [ - "{'brazil', 'china', 'india', 'russia'}" - ] - } - ], - "prompt_number": 88 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## string\u7684\u4e00\u4e9b\u5176\u4ed6\u65b9\u6cd5\n", - "\n", - "* startswith\n", - "* endswith\n", - "* in\n", - "* find\n", - "* replace\n", - "* upper\n", - "* lower\n", - "* join\n", - "* split" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "name = 'Swaroop'\n", - "if name.startswith('Swa'):\n", - " print('Yes, the string starts with \"Swa\"')\n", - "\n", - "if 'a' in name:\n", - " print('Yes, it contains the string \"a\"')\n", - "\n", - "pos = name.find('war')\n", - "if pos != -1:\n", - " print('position of the string \"war\" is %d' % pos)\n", - "\n", - "print(\"the string replace war to peace is %s\" % name.replace('war', 'peace'))\n", - "print(\"the string replace o to 0 is %s\" % name.replace('o', '0'))\n", - "\n", - "print(\"upper case: %s\" % name.upper())\n", - "print(\"lower case: %s\" % name.lower())\n", - "\n", - "delimiter = '_*_'\n", - "mylist = ['Brazil', 'Russia', 'India', 'China']\n", - "print(delimiter.join(mylist))\n", - "\n", - "print(delimiter.join(mylist).split(delimiter))\n", - "print(delimiter.join(mylist).split('*'))" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Yes, the string starts with \"Swa\"\n", - "Yes, it contains the string \"a\"\n", - "position of the string \"war\" is 1\n", - "the string replace war to peace is Speaceoop\n", - "the string replace o to 0 is Swar00p\n", - "upper case: SWAROOP\n", - "lower case: swaroop\n", - "Brazil_*_Russia_*_India_*_China\n", - "['Brazil', 'Russia', 'India', 'China']\n", - "['Brazil_', '_Russia_', '_India_', '_China']\n" - ] - } - ], - "prompt_number": 89 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7ec3\u4e60\n", - "\n", - "\u6bcf\u4e2a\u56fd\u5bb6\u90fd\u6709\u4e00\u5b9a\u7684\u5730\u533a\u53f7\u7801\uff0c\u73b0\u5728\u6211\u4eec\u77e5\u9053\u8fd9\u4e9b\u56fd\u5bb6\u548c\u5730\u533a\u53f7\u7801\u5173\u7cfb\uff1a\n", - "\n", - "+30 \u5e0c\u814a +45 \u4e39\u9ea6 +51 \u79d8\u9c81 +65 \u65b0\u52a0\u5761 +86 \u4e2d\u56fd\n", - "\n", - "\u5199\u4ee3\u7801\u6c42\u51fa\u4ee5\u4e0b\u7535\u8bdd\u53f7\u7801\u91cc\u9762\u6709\u51e0\u4e2a\u56fd\u5bb6\uff1a\n", - "\n", - "+86 1123 +65 1234 +51 2347 +30 9123 +65 1246 +30 2347 +86 2935" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7b54\u6848" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "number2country = {\n", - " '+30': u'\u5e0c\u814a',\n", - " '+45': u'\u4e39\u9ea6',\n", - " '+51': u'\u79d8\u9c81',\n", - " '+65': u'\u65b0\u52a0\u5761',\n", - " '+86': u'\u4e2d\u56fd'\n", - "}\n", - "\n", - "numbers = \"+86 1123 +65 1234 +51 2347 +30 9123 +65 1246 +30 2347 +86 2935\".split()\n", - "country_set = set([number2country[n] for n in numbers if n.startswith('+')])\n", - "\n", - "print(len(country_set))\n", - "# \u6ce8\u610f\uff1a\u8fd9\u91cc\u7684\u8f93\u51fa\u987a\u5e8f\u5728\u4e0d\u540c\u7684\u673a\u5668\u4e0a\u53ef\u80fd\u4e0d\u4e00\u6837\uff0c\u5177\u4f53\u4f9d\u8d56\u4e8epython\u7684\u7248\u672c\u548c\u5b9e\u73b0\u3002set\u672c\u8eab\u662f\u6ca1\u6709\u987a\u5e8f\u7ea6\u5b9a\u7684\u3002\n", - "print(', '.join(country_set))" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n", - "\u4e2d\u56fd, \u65b0\u52a0\u5761, \u79d8\u9c81, \u5e0c\u814a\n" - ] - } - ], - "prompt_number": 90 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "numbers = \"+86 1123 +65 1234 +51 2347 +30 9123 +65 1246 +30 2347 +86 2935\".split()\n", - "print(\"numbers: %s\" % str(numbers))\n", - "print(\"filtered: %s\" % str([n for n in numbers if n.startswith('+')]))\n", - "print(\"filtered and mapped: %s\" % ', '.join([number2country[n] for n in numbers if n.startswith('+')]))\n", - "country_set = set([number2country[n] for n in numbers if n.startswith('+')])\n", - "print(', '.join(country_set))" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "numbers: ['+86', '1123', '+65', '1234', '+51', '2347', '+30', '9123', '+65', '1246', '+30', '2347', '+86', '2935']\n", - "filtered: ['+86', '+65', '+51', '+30', '+65', '+30', '+86']\n", - "filtered and mapped: \u4e2d\u56fd, \u65b0\u52a0\u5761, \u79d8\u9c81, \u5e0c\u814a, \u65b0\u52a0\u5761, \u5e0c\u814a, \u4e2d\u56fd\n", - "\u4e2d\u56fd, \u65b0\u52a0\u5761, \u79d8\u9c81, \u5e0c\u814a\n" - ] - } - ], - "prompt_number": 91 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "slide" - } - }, - "source": [ - "# \u9762\u5bf9\u5bf9\u8c61\u7f16\u7a0b" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "notes" - } - }, - "source": [ - "\u201c\u4e00\u4e2a\u82f9\u679c\u52a0\u4e00\u4e2a\u82f9\u679c\u662f\u4ec0\u4e48\uff1f\u201d\n", - "\n", - "\u201c\u4e24\u4e2a\u82f9\u679c\u3002\u201d\n", - "\n", - "\u201c\u4e00\u4e2a\u96ea\u68a8\u52a0\u4e00\u4e2a\u96ea\u68a8\u5462\uff1f\u201d\n", - "\n", - "\u201c\u4e24\u4e2a\u96ea\u68a8\u3002\u201d\n", - "\n", - "\u201c\u4e00\u4e2a\u82f9\u679c\u52a0\u4e00\u4e2a\u96ea\u68a8\u5462\uff1f\u201d\n", - "\n", - "\u201c\u2026\u2026\u201d\n", - "\n", - "\u867d\u7136\u59b2\u67ef\u59ae\u4e1d\u4e0d\u77e5\u9053\u8fd9\u548c\u6b23\u8d4f\u62bd\u8c61\u753b\u6709\u4ec0\u4e48\u5173\u7cfb\uff0c\u4f46\u8fd8\u662f\u6572\u7740\u989d\u5934\u60f3\u4e86\u60f3\u3002\n", - "\n", - "\u201c\u2026\u2026\u4e24\u4e2a\u6c34\u679c\uff1f\u201d\n", - "\n", - "\u201c\u660e\u767d\u4e86\u5427\uff1f\u201d\u51b0\u6e05\u7075\u770b\u7740\u82e5\u6709\u6240\u601d\u7684\u59b2\u67ef\u59ae\u4e1d\u7b11\u9053\uff0c\u201c\u4ece\u82f9\u679c\u3001\u96ea\u68a8\u5230\u6c34\u679c\uff0c\u5176\u5b9e\u662f\u4e00\u4e2a\u53bb\u6389\u4e0d\u540c\u7684\u90e8\u5206\uff0c\u7136\u540e\u628a\u76f8\u540c\u7684\u90e8\u5206\u8fdb\u884c\u7d2f\u52a0\u7684\u4e00\u4e2a\u8fc7\u7a0b\u3002\u4ece\u6c34\u679c\u3001\u676f\u5b50\u5230\u2018\u4e1c\u897f\u2019\uff0c\u4e5f\u662f\u5b83\u4eec\u7684\u5b58\u5728\u672c\u8eab\uff0c\u4e5f\u662f\u4e00\u6837\u7684\u9053\u7406\u3002\u201d\n", - "\n", - "\u2014\u2014XINPINGYE\u300a\u5fa1\u5929\u8005.\u661f\u661f\u300b" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## class\n", - "\n", - "\u5982\u4f55\u5b9a\u4e49\u7c7b\uff1a" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Person:\n", - " pass # An empty block" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 92 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "\u5982\u4f55\u4f7f\u7528\u7c7b\u4ea7\u751f\u5bf9\u8c61\uff1a" + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello\n", + "WorldWorldWorldWorldWorld\n" ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "p = Person()\n", - "print(p)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "<__main__.person instance at 0x7f7fbc419128>\n" - ] - } - ], - "prompt_number": 93 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u65b9\u6cd5\n", - "\n", - "\u5982\u4f55\u5b9a\u4e49\u7c7b\u7684\u6210\u5458\u65b9\u6cd5\uff1a" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Person:\n", - " def say_hi(self):\n", - " print('Hello, how are you?')\n", - "\n", - "p = Person()\n", - "p.say_hi()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hello, how are you?\n" - ] - } - ], - "prompt_number": 94 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u6570\u636e\n", - "\n", - "\u5bf9\u8c61\u91cc\u5305\u542b\u7684\u6570\u636e\u3002\n", - "\n", - "\u53ef\u4ee5\u7528.\u8bbf\u95ee\u3002\n", - "\n", - "\u548c\u65b9\u6cd5\u7684\u4e3b\u8981\u5dee\u522b\u5728\u4e8e\u3002\u65b9\u6cd5\u9700\u8981\u4f7f\u7528()\u6765\u8c03\u7528\uff0c\u800c\u6570\u636e\u4e0d\u9700\u8981\u3002" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Person:\n", - " def set_name(self, name):\n", - " self.name = name\n", - "\n", - " def say_hi(self):\n", - " print('hello, {}, how are you?'.format(self.name))\n", - " \n", - "p = Person()\n", - "p.set_name('shell')\n", - "print(p.name)\n", - "p.say_hi()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "shell\n", - "hello, shell, how are you?\n" - ] - } - ], - "prompt_number": 95 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## self\n", - "\n", - "\u5728python\u4e2d\uff0c\u6210\u5458\u51fd\u6570\u4f7f\u7528\u201dself\u201d\u6765\u6307\u4ee3\u5bf9\u8c61\u81ea\u8eab\u3002\u7c7b\u4f3c\u4e8ejava\u548cC++\u4e2d\u7684\u201dthis\u201d\u3002\n", - "\n", - "\u5728\u8c03\u7528\u65f6\uff0cp.say_hi()\u5373\u53ef\u3002\u4e0d\u9700\u8981\u4f20\u9012p.say_hi(self)\u6216\u8005p.say_hi(p)\u3002\n", - "\n", - "\u5728\u4f7f\u7528\u65f6\uff0c\u9700\u8981\u5148\u5c06self\u5b9a\u4e49\u4e3a\u7b2c\u4e00\u4e2a\u53c2\u6570\u3002\u4f8b\u5982def say_hi(self):\u3002\n", - " \n", - "\u5728\u51fd\u6570\u5185\u4f7f\u7528\u65f6\uff0c\u5bf9\u8c61\u7684\u6210\u5458\u9700\u8981\u7528self.xx\u7684\u65b9\u5f0f\u4f7f\u7528\uff0c\u4f8b\u5982self.name\u3002\n", - "\n", - "self\u4e0d\u662f\u5173\u952e\u8bcd\uff0c\u4e5f\u4e0d\u662f\u5f3a\u5236\u540d\u79f0\u3002\u5b83\u53ea\u662f\u51fd\u6570\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u3002\u4f46\u662f\u4e3a\u4e86\u4fdd\u6301\u4f20\u7edf\uff0c\u8bf7\u4e0d\u8981\u5c06\u4ed6\u6539\u4e3a\u5176\u4ed6\u540d\u79f0\u3002" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \\_\\_init\\_\\_\u65b9\u6cd5\n", - "\n", - "\\_\\_init\\_\\_\u662f\u5bf9\u8c61\u7684\u7b2c\u4e00\u4e2a\u65b9\u6cd5\uff0c\u7528\u4e8e\u521d\u59cb\u5316\u5bf9\u8c61\u6570\u636e\u3002\n", - "\n", - "\\_\\_init\\_\\_\u51fd\u6570\u662f\u521d\u59cb\u5316\u65b9\u6cd5\uff0c\u800c\u975e\u6784\u9020\u65b9\u6cd5\u3002\n", - "\n", - "\u5728\\_\\_init\\_\\_\u51fd\u6570\u88ab\u8c03\u7528\u65f6\uff0cself\u5bf9\u8c61\u5df2\u7ecf\u521b\u5efa\u5b8c\u6bd5\u3002\n", - "\n", - "\u5728python\u4e2d\uff0c\u5bf9\u8c61\u7684\u5c5e\u6027\u53ef\u4ee5\u81ea\u7531\u6dfb\u52a0\u5220\u9664\uff0c\u4e0d\u9700\u8981\u5148\u5728\u7c7b\u91cc\u9762\u58f0\u660e\u3002\n", - "\n", - "\u4e00\u822c\u800c\u8a00\uff0c\u5bf9\u8c61\u91cc\u7684\u6240\u6709\u6570\u636e\u4f1a\u5728\\_\\_init\\_\\_\u65b9\u6cd5\u4e2d\u8d4b\u503c\uff0c\u540e\u9762\u53ef\u4ee5\u53d8\u66f4\u3002\n", - "\n", - "\u4f46\u662f\u4e0d\u5728\\_\\_init\\_\\_\u4e2d\u8d4b\u503c\uff0c\u540e\u9762\u76f4\u63a5\u8d4b\u503c\u521b\u5efa\u5c5e\u6027\u4e5f\u662f\u5408\u6cd5\u7684\u3002" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Person:\n", - " def __init__(self, name):\n", - " self.name = name\n", - "\n", - " def set_name(self, name):\n", - " self.name = name\n", - "\n", - " def say_hi(self):\n", - " print('hello, {}, how are you?'.format(self.name))\n", - "\n", - "p = Person('Swaroop')\n", - "print(p.name)\n", - "p.say_hi()\n", - "\n", - "p.set_name('shell')\n", - "print(p.name)\n", - "p.say_hi()" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Swaroop\n", - "hello, Swaroop, how are you?\n", - "shell\n", - "hello, shell, how are you?\n" - ] - } - ], - "prompt_number": 96 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7ec3\u4e60\n", - "\n", - "\u5b9a\u4e49\u4e00\u4e2a\u9a6c\u514b\u676f\u7c7b\uff0c\u5b9a\u4e49\u4e00\u4e2a\u52a0\u6c34\u65b9\u6cd5\u548c\u4e00\u4e2a\u559d\u6c34\u65b9\u6cd5\u3002" + } + ], + "source": [ + "def say(message, times=1):\n", + " print(message * times)\n", + "\n", + "say('Hello')\n", + "say('World', 5)" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1]\n", + "[1]\n", + "------\n", + "[1]\n", + "[1, 1]\n" ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7b54\u6848" + } + ], + "source": [ + "def append1(l=[]):\n", + " l.append(1)\n", + " return l\n", + "\n", + "print(append1([]))\n", + "print(append1([]))\n", + "\n", + "print('------')\n", + "\n", + "print(append1())\n", + "print(append1())" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "遇到希望使用可变对象作为参数默认值的情况,需要使用None作为默认值。\n", + "\n", + "在函数中判断是否为None,是的话再对参数做默认值赋值处理。\n", + "\n", + "以此模式来避免上述问题。" + ] + }, + { + "cell_type": "code", + "execution_count": 50, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1]\n", + "[1]\n", + "------\n", + "[1]\n", + "[1]\n" ] - }, + } + ], + "source": [ + "def append1(l=None):\n", + " if l is None:\n", + " l = []\n", + " l.append(1)\n", + " return l\n", + "\n", + "print(append1([]))\n", + "print(append1([]))\n", + "\n", + "print('------')\n", + "\n", + "print(append1())\n", + "print(append1())" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 返回值\n", + "\n", + "将函数内数据传递回去。" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "metadata": {}, + "outputs": [ { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Mug:\n", - "\n", - " def __init__(self):\n", - " self.water = 0\n", - "\n", - " def drink(self, mass):\n", - " self.water -= mass\n", - "\n", - " def watering(self, mass):\n", - " self.water += mass" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 97 - }, + "name": "stdout", + "output_type": "stream", + "text": [ + "3\n", + "The numbers are equal\n" + ] + } + ], + "source": [ + "def maximum(x, y):\n", + " if x> y:\n", + " return x\n", + " elif x == y:\n", + " return 'The numbers are equal'\n", + " else:\n", + " return y\n", + "\n", + "print(maximum(2, 3))\n", + "print(maximum(2, 2))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 多值返回\n", + "\n", + "Python允许一次返回多个值。\n", + "\n", + "多值返回的本质是使用tuple中转(后面详细讲解)。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "source": [ + "提前强调"最小惊讶原则"。" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7c7b\u6210\u5458\u548c\u5bf9\u8c61\u6210\u5458\n", - "\n", - "\u7c7b\u548c\u5bf9\u8c61\u5206\u522b\u62e5\u6709\u6210\u5458\uff0c\u4f8b\u5982\u6570\u636e\u548c\u65b9\u6cd5\u3002\n", - "\n", - "\u5bf9\u8c61\u53ef\u4ee5\u5f15\u7528\u7c7b\u6210\u5458\uff0c\u4f8b\u5982p.say_hi()\u3002\u4e5f\u53ef\u4ee5\u5f15\u7528\u5bf9\u8c61\u6210\u5458\uff0c\u6216\u8005self.name\u3002\n", - "\n", - "\u5f53\u6709\u91cd\u540d\u65f6\u4f18\u5148\u5f15\u7528\u5bf9\u8c61\u6210\u5458\u3002\n", - "\n", - "\u7c7b\u6210\u5458\u5728\u6240\u6709\u5bf9\u8c61\u95f4\u5171\u4eab\uff0c\u800c\u5bf9\u8c61\u6210\u5458\u53ea\u662f\u5b83\u81ea\u5df1\u7684\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "(1, 2, 3, 4, 5)\n", + "3\n" ] - }, + } + ], + "source": [ + "def f():\n", + " return 1,2,3,4,5\n", + "print (f())\n", + "\n", + "a,b,c,d,e = f()\n", + "print(c)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## Doc String\n", + "\n", + "Python允许为每个函数增加一个文档字符串,这个文档字符串可以被代码访问。\n", + "\n", + "具体方式是,在函数的第一个逻辑行定义一个字符串(不执行任何操作)。\n", + "\n", + "访问方式是function.\\_\\_doc\\_\\_。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "source": [ + "讲解doc string在文档里的作用,对比java doc。" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "notes" - } - }, - "source": [ - "\u8fd9\u91cc\u662f\u5426\u8981\u52a0\u4e2a\u4f8b\u5b50\u8bf4\u660e\u7c7b\u548c\u5bf9\u8c61\u53d8\u91cf\u7684\u4f18\u5148\u5f15\u7528\u6b21\u5e8f\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "5 is maximum\n", + "Prints the maximum of two numbers. \n", + "The two values must be integers.\n" ] - }, + } + ], + "source": [ + "def print_max(x, y):\n", + " '''Prints the maximum of two numbers. \\nThe two values must be integers.'''\n", + " x = int(x)\n", + " y = int(y)\n", + " if x> y:\n", + " print('{} is maximum'.format(x))\n", + " else:\n", + " print('{} is maximum'.format(y))\n", + "\n", + "print_max(3, 5)\n", + "print(print_max.__doc__)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "# Annotations\n", + "\n", + "Python允许对函数的变量进行注解,表明参数和返回值的类型。" + ] + }, + { + "cell_type": "code", + "execution_count": 54, + "metadata": {}, + "outputs": [ { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Robot:\n", - " \"\"\"Represents a robot, with a name.\"\"\"\n", - "\n", - " # A class variable, counting the number of robots\n", - " population = 0\n", - "\n", - " def __init__(self, name):\n", - " \"\"\"Initializes the data.\"\"\"\n", - " self.name = name\n", - " print(\"(Initializing {})\".format(self.name))\n", - " # When this person is created, the robot\n", - " # adds to the population\n", - " Robot.population += 1\n", - "\n", - " def die(self):\n", - " \"\"\"I am dying.\"\"\"\n", - " print(\"{} is being destroyed!\".format(self.name))\n", - " Robot.population -= 1\n", - " if Robot.population == 0:\n", - " print(\"{} was the last one.\".format(self.name))\n", - " else:\n", - " print(\"There are still {:d} robots working.\".format(\n", - " Robot.population))\n", - "\n", - " def say_hi(self):\n", - " \"\"\"Greeting by the robot.\n", - " Yeah, they can do that.\"\"\"\n", - " print(\"Greetings, my masters call me {}.\".format(self.name))\n", - "\n", - " @classmethod\n", - " def how_many(cls):\n", - " \"\"\"Prints the current population.\"\"\"\n", - " print(\"We have {:d} robots.\".format(cls.population))" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } + "data": { + "text/plain": [ + "2" + ] }, - "outputs": [], - "prompt_number": 98 - }, + "execution_count": 54, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "def maximum(x: int, y: int) -> int:\n", + " if x> y:\n", + " return x\n", + " elif x == y:\n", + " return 'The numbers are equal'\n", + " else:\n", + " return y\n", + "\n", + "maximum(1, 2)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "然而,Python默认对注解不做验证。" + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "metadata": { + "slideshow": { + "slide_type": "-" + } + }, + "outputs": [ { - "cell_type": "code", - "collapsed": false, - "input": [ - "droid1 = Robot(\"R2-D2\")\n", - "droid1.say_hi()\n", - "Robot.how_many()\n", - "\n", - "droid2 = Robot(\"C-3PO\")\n", - "droid2.say_hi()\n", - "Robot.how_many()\n", - "\n", - "print(\"\\nRobots can do some work here.\\n\")\n", - "\n", - "print(\"Robots have finished their work. So let's destroy them.\")\n", - "droid1.die()\n", - "droid2.die()\n", - "\n", - "Robot.how_many()" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } + "data": { + "text/plain": [ + "'2'" + ] }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(Initializing R2-D2)\n", - "Greetings, my masters call me R2-D2.\n", - "We have 1 robots.\n", - "(Initializing C-3PO)\n", - "Greetings, my masters call me C-3PO.\n", - "We have 2 robots.\n", - "\n", - "Robots can do some work here.\n", - "\n", - "Robots have finished their work. So let's destroy them.\n", - "R2-D2 is being destroyed!\n", - "There are still 1 robots working.\n", - "C-3PO is being destroyed!\n", - "C-3PO was the last one.\n", - "We have 0 robots.\n" - ] - } - ], - "prompt_number": 99 - }, + "execution_count": 55, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "maximum('1', '2')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## lambda\n", + "\n", + "一种快速定义简单函数的方法。" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7ec3\u4e60\n", - "\n", - "\u56de\u60f3\u4e00\u4e0b\uff0c\u4e0a\u4e00\u8282\u4f60\u7684\u5b9a\u4e49\u91cc\u662f\u5426\u8003\u8651\u4e86\u9a6c\u514b\u676f\u7684\u201c\u6700\u5927\u5bb9\u91cf\u201d\u3002\u5982\u679c\u6ca1\u6709\uff0c\u8bf7\u52a0\u4e0a\u3002\n", - "\n", - "\u601d\u8003\u4e00\u4e0b\uff0c\u201c\u6700\u5927\u5bb9\u91cf\u201d\u662f\u5bf9\u8c61\u5c5e\u6027\u8fd8\u662f\u7c7b\u5c5e\u6027\uff0c\u4e3a\u4ec0\u4e48\uff1f" + "name": "stdout", + "output_type": "stream", + "text": [ + "11\n", + "11\n" ] - }, + } + ], + "source": [ + "def inc(n):\n", + " return n+1\n", + "print(inc(10))\n", + "\n", + "inc = lambda n: n+1\n", + "print(inc(10))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 练习\n", + "\n", + "定义fib函数。\n", + "\n", + "输入n,fib的输出为数列第n项的值。\n", + "\n", + "数列某项等于前两项之和。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "source": [ + "可演示递归和循环算法,比较其特性。说明简洁和快速的矛盾。\n", + "\n", + "可以在最后使用for循环打印输出,为后面"\\_\\_main\\_\\_标准写法"打基础。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 答案" + ] + }, + { + "cell_type": "code", + "execution_count": 57, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } + "data": { + "text/plain": [ + "89" + ] }, - "source": [ - "## \u7b54\u6848" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Mug:\n", - "\n", - " capacity = 300\n", - "\n", - " def __init__(self):\n", - " self.water = 0\n", - "\n", - " def drink(self, mass):\n", - " self.water -= mass\n", - " if self.water < 0:\n", - " self.water = 0\n", - "\n", - " def watering(self, mass):\n", - " self.water += mass\n", - " if self.water> self.capacity:\n", - " self.water = self.capacity" - ], - "language": "python", + "execution_count": 57, "metadata": {}, - "outputs": [], - "prompt_number": 100 - }, + "output_type": "execute_result" + } + ], + "source": [ + "def fib(n):\n", + " if n <= 1: return 1\n", + " return fib(n-1) + fib(n-2)\n", + "\n", + "fib(10)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "# 模块" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## Module\n", + "\n", + "预先写好的代码,供其他代码使用。\n", + "\n", + "一个module是一个独立文件。\n", + "\n", + "每个module拥有自己的全局变量空间。数据定义,函数,均定义在其中。" + ] + }, + { + "cell_type": "code", + "execution_count": 58, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7ee7\u627f\n", - "\n", - "\u7ee7\u627f\u5173\u7cfb\u5206\u4e3a\u57fa\u7c7b\u548c\u7ee7\u627f\u7c7b\uff08\u4e5f\u53eb\u7236\u7c7b\u548c\u5b50\u7c7b\uff09\u3002\n", - "\n", - "\u5b50\u7c7b\u53ef\u4ee5\u7ee7\u627f\u7236\u7c7b\u7684\u6210\u5458\u3002\u5f53\u5b50\u7c7b\u548c\u7236\u7c7b\u5b9a\u4e49\u540c\u540d\u6210\u5458\u65f6\uff0c\u4f18\u5148\u5f15\u7528\u5b50\u7c7b\u7684\u3002\n", - "\n", - "\u539f\u5219\u4e0a\u8bf4\uff0c\u7236\u7c7b\u80fd\u505a\u7684\u4e8b\uff0c\u5b50\u7c7b\u4e00\u5b9a\u80fd\u505a\uff08\u867d\u7136\u884c\u4e3a\u53ef\u80fd\u6709\u5dee\u5f02\uff09\u3002\u7236\u7c7b\u80fd\u51fa\u73b0\u7684\u5730\u65b9\uff0c\u5b50\u7c7b\u4e00\u5b9a\u80fd\u51fa\u73b0\u3002\n", - "\n", - "\u56e0\u4e3a\u5b50\u7c7b\u62e5\u6709\u7236\u7c7b\u7684\u6240\u6709\u6210\u5458\u3002\n", - "\n", - "\u7ee7\u627f\u7684\u5199\u6cd5\u4e3a\uff1a\n", - "\n", - " class Person(Animal):\n", - " pass" + "name": "stdout", + "output_type": "stream", + "text": [ + "Writing testmod.py\n" ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class SchoolMember:\n", - " '''Represents any school member.'''\n", - " def __init__(self, name, age):\n", - " self.name = name\n", - " self.age = age\n", - " print('(Initialized SchoolMember: {})'.format(self.name))\n", - "\n", - " def tell(self):\n", - " '''Tell my details.'''\n", - " print('Name:\"{}\" Age:\"{}\"'.format(self.name, self.age))\n", - "\n", - "\n", - "class Teacher(SchoolMember):\n", - " '''Represents a teacher.'''\n", - " def __init__(self, name, age, salary):\n", - " SchoolMember.__init__(self, name, age)\n", - " self.salary = salary\n", - " print('(Initialized Teacher: {})'.format(self.name))\n", - "\n", - " def tell(self):\n", - " SchoolMember.tell(self)\n", - " print('Salary: \"{:d}\"'.format(self.salary))" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [], - "prompt_number": 101 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Student(SchoolMember):\n", - " '''Represents a student.'''\n", - " def __init__(self, name, age, marks):\n", - " SchoolMember.__init__(self, name, age)\n", - " self.marks = marks\n", - " print('(Initialized Student: {})'.format(self.name))\n", - "\n", - " def tell(self):\n", - " SchoolMember.tell(self)\n", - " print('Marks: \"{:d}\"'.format(self.marks))\n", - "\n", - "t = Teacher('Mrs. Shrividya', 40, 30000)\n", - "s = Student('Swaroop', 25, 75)\n", - "\n", - "# prints a blank line\n", - "print()\n", - "\n", - "members = [t, s]\n", - "for member in members:\n", - " # Works for both Teachers and Students\n", - " member.tell()" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(Initialized SchoolMember: Mrs. Shrividya)\n", - "(Initialized Teacher: Mrs. Shrividya)\n", - "(Initialized SchoolMember: Swaroop)\n", - "(Initialized Student: Swaroop)\n", - "()\n", - "Name:\"Mrs. Shrividya\" Age:\"40\"\n", - "Salary: \"30000\"\n", - "Name:\"Swaroop\" Age:\"25\"\n", - "Marks: \"75\"\n" - ] - } - ], - "prompt_number": 102 - }, + } + ], + "source": [ + "%%writefile testmod.py\n", + "varible1 = 1\n", + "varible2 = 2\n", + "\n", + "def add(a, b):\n", + " return a+b\n", + "\n", + "if __name__ == '__main__':\n", + " print('run as script')" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7ec3\u4e60\n", - "\n", - "\u8bf7\u4e3a\u9a6c\u514b\u676f\u589e\u52a0\u4e00\u4e2a\u201c\u6dfb\u6ee1\u201d\u65b9\u6cd5\uff0c\u53ef\u4ee5\u6c42\u51fa\u9700\u8981\u6dfb\u591a\u5c11\u6c34\u5230\u52a0\u6ee1\uff0c\u5e76\u81ea\u52a8\u4e3a\u676f\u5b50\u52a0\u6c34\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "-rw-r--r-- 1 shell shell 111 Mar 22 20:06 testmod.py\r\n" ] - }, + } + ], + "source": [ + "!ls -l testmod.py" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Windows下要用dir testmod.py" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## import\n", + "\n", + "import引入某个module对象,可使用module.name的方式引用它的全局变量。" + ] + }, + { + "cell_type": "code", + "execution_count": 60, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } + "data": { + "text/plain": [ + "1" + ] }, - "source": [ - "## \u7b54\u6848" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Mug(object):\n", - " capacity = 300\n", - "\n", - " def __init__(self):\n", - " self.water = 0\n", - "\n", - " def drink(self, mass):\n", - " self.water -= mass\n", - " if self.water < 0:\n", - " self.water = 0\n", - "\n", - " def watering(self, mass):\n", - " self.water += mass\n", - " if self.water> self.capacity:\n", - " self.water = self.capacity\n", - "\n", - " def full(self):\n", - " mass = self.capacity - self.water\n", - " self.watering(mass)" - ], - "language": "python", + "execution_count": 60, "metadata": {}, - "outputs": [], - "prompt_number": 103 - }, + "output_type": "execute_result" + } + ], + "source": [ + "import testmod\n", + "testmod.varible1" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## from import\n", + "\n", + "from import引入模块中的某个(或全部)变量。\n", + "\n", + "被引入变量不需要module.name来访问,仅需要name。\n", + "\n", + "注意:不推荐引入全部变量,会引起名称空间污染。" + ] + }, + { + "cell_type": "code", + "execution_count": 61, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } + "data": { + "text/plain": [ + "2" + ] }, - "source": [ - "## \u7ec3\u4e60\n", - "\n", - "\u8bf7\u5b9a\u4e49\u4e00\u4e2a\u8fd0\u52a8\u676f\u7c7b\uff0c\u5e76\u540c\u6837\u5b9e\u73b0\u201c\u559d\u6c34\u201d\uff0c\u201c\u52a0\u6c34\u201d\u548c\u201c\u6dfb\u6ee1\u201d\u65b9\u6cd5\u3002" - ] - }, + "execution_count": 61, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from testmod import varible2\n", + "varible2" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## dir\n", + "\n", + "列出某个模块的所有变量。" + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['__builtins__',\n", + " '__cached__',\n", + " '__doc__',\n", + " '__file__',\n", + " '__loader__',\n", + " '__name__',\n", + " '__package__',\n", + " '__spec__',\n", + " 'add',\n", + " 'varible1',\n", + " 'varible2']" + ] + }, + "execution_count": 62, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import testmod\n", + "dir(testmod)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 模块预编译\n", + "\n", + "当import时,python会试图去编译出pyc文件来。\n", + "\n", + "pyc是被编译过的py文件,加载pyc文件可以跳过语法解析过程。\n", + "\n", + "当py日期新于pyc时,重新生成pyc。所以日期紊乱可能导致执行老代码。\n", + "\n", + "在Python3(3.2以后)中,会在当前目录下生成\\_\\_pycache\\_\\_目录,来缓存pyc文件。\n", + "\n", + "这样可以避免多个Python解释器无法互相载入对方的pyc文件。\n", + "\n", + "具体可以参考这里: https://docs.python.org/3/whatsnew/3.2.html " + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "source": [ + "注意加载顺序导致当前目录模块名和系统相同时会发生覆盖问题。\n", + "\n", + "同时注意这个现象受制于系统库是否已经载入,从而引出系统库不会多次"加载"的结论。" + ] + }, + { + "cell_type": "code", + "execution_count": 63, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7ec3\u4e60\n", - "\n", - "\u8003\u8651\u4e00\u4e0b\uff0c\u5982\u679c\u201c\u9a6c\u514b\u676f\u201d\u548c\u201c\u8fd0\u52a8\u676f\u201d\u7684\u201c\u559d\u6c34\u201d\u548c\u201c\u6dfb\u6c34\u201d\u884c\u4e3a\u662f\u4e0d\u4e00\u6837\u7684\u3002\n", - "\n", - "\u90a3\u4e48\uff0c\u201c\u6dfb\u6ee1\u201d\u884c\u4e3a\u662f\u5426\u4e00\u6837\uff0c\u4e24\u8fb9\u662f\u5426\u53ef\u4ee5\u91cd\u7528\u201c\u6dfb\u6ee1\u201d\uff1f\n", - "\n", - "\u5982\u679c\u53ef\u4ee5\uff0c\u600e\u4e48\u505a\uff1f" + "name": "stdout", + "output_type": "stream", + "text": [ + "-rw-r--r-- 1 shell shell 111 Mar 22 20:06 testmod.py\r\n" ] - }, + } + ], + "source": [ + "!ls -l testmod*" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7b54\u6848" + "name": "stdout", + "output_type": "stream", + "text": [ + "-rw-r--r-- 1 shell shell 365 Jun 25 2018 __pycache__/testmod.cpython-35.pyc\r\n", + "-rw-r--r-- 1 shell shell 349 Mar 22 20:06 __pycache__/testmod.cpython-37.pyc\r\n" ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "class Cup(object):\n", - "\n", - " def __init__(self):\n", - " self.water = 0\n", - "\n", - " def full(self):\n", - " mass = self.capacity - self.water\n", - " self.watering(mass)\n", - "\n", - "class Mug(Cup):\n", - " capacity = 300\n", - "\n", - " def drink(self, mass):\n", - " self.water -= mass\n", - " if self.water < 0:\n", - " self.water = 0\n", - "\n", - " def watering(self, mass):\n", - " self.water += mass\n", - " if self.water> self.capacity:\n", - " self.water = self.capacity\n", - "\n", - "class SportBottle(Cup):\n", - " capacity = 500\n", - "\n", - " def drink(self, mass):\n", - " self.water -= mass\n", - " if self.water < 0:\n", - " self.water = 0\n", - "\n", - " def watering(self, mass):\n", - " self.water += mass\n", - " if self.water> self.capacity:\n", - " self.water = self.capacity" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "-" - } - }, - "outputs": [], - "prompt_number": 104 - }, + } + ], + "source": [ + "!ls -l __pycache__/testmod*" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "由于这个系统使用了Python3作为基础,因此没有`testmod.pyc`文件。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## \\_\\_name\\_\\_属性\n", + "\n", + "模块有一个属性,\\_\\_name\\_\\_。当这个属性为'\\_\\_main\\_\\_'时,说明当前模块被作为脚本运行。\n", + "\n", + "模块被作为以脚本运行时,不生成pyc文件(因为不是import)。" + ] + }, + { + "cell_type": "code", + "execution_count": 65, + "metadata": {}, + "outputs": [ { - "cell_type": "code", - "collapsed": false, - "input": [ - "m = Mug()\n", - "m.full()\n", - "m.drink(100)\n", - "print(m.water)\n", - "\n", - "s = SportBottle()\n", - "s.full()\n", - "s.drink(100)\n", - "print(s.water)" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } + "data": { + "text/plain": [ + "'__main__'" + ] }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "200\n", - "400\n" - ] - } - ], - "prompt_number": 105 - }, + "execution_count": 65, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "__name__" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "slide" - } + "data": { + "text/plain": [ + "'testmod'" + ] }, - "source": [ - "# \u8f93\u5165\u8f93\u51fa" + "execution_count": 66, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "testmod.__name__" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## Main文件模式化写法" + ] + }, + { + "cell_type": "code", + "execution_count": 67, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "if __name__ == '__main__':\r\n", + " print('run as script')" ] - }, + } + ], + "source": [ + "!tail -n 2 testmod.py" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u4ece\u547d\u4ee4\u884c\u8f93\u5165\n", - "\n", - "python3\u4f7f\u7528input\u4ece\u547d\u4ee4\u884c\u8f93\u5165\u3002python2\u4f7f\u7528raw_input\u4ece\u547d\u4ee4\u884c\u8f93\u5165\u3002\n", - "\n", - "\u4e24\u8005\u53c2\u6570\u4e00\u81f4\uff0c\u90fd\u662f\u4e00\u4e2a\u63d0\u793a\u5b57\u7b26\u4e32\u3002\n", - "\n", - "\u5728python2\u4e2d\uff0cinput\u662feval(input)\uff0c\u6709\u5b89\u5168\u6027\u95ee\u9898\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "run as script\r\n" ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Rise to vote, sir.\n", - "try:\n", - " input = raw_input\n", - "except NameError:\n", - " pass\n", - "\n", - "def reverse(text):\n", - " return text[::-1]\n", - "\n", - "def is_palindrome(text):\n", - " return text == reverse(text)\n", - "\n", - "something = input(\"Enter text: \")\n", - "\n", - "if is_palindrome(something):\n", - " print(\"Yes, it is a palindrome\")\n", - "else:\n", - " print(\"No, it is not a palindrome\")" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter text: Rise to vote, sir.\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "No, it is not a palindrome\n" - ] - } - ], - "prompt_number": 106 - }, + } + ], + "source": [ + "!python testmod.py" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "outputs": [], + "source": [ + "!rm testmod*" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## Package\n", + "\n", + "从组织结构上说,package是比modules更大一级的结构。\n", + "\n", + "一个package里可以包含多个modules和packages。\n", + "\n", + "一般一个package是一个独立目录,里面有\\_\\_init\\_\\_.py文件。\n", + "\n", + "这个文件指明了如何加载整个package。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "source": [ + "可以找一些实际的文件布局的例子。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 练习\n", + "\n", + "* 导入系统sys模块\n", + "* 列出sys模块中以s开头并且以e结尾的成员。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "source": [ + "此处需要提前说明startswith和endswith的用法。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 答案" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7ec3\u4e60\n", - "\n", - "\u521a\u521a\u7684\u56de\u6587\u5b57\u7b26\u4e32\u7a0b\u5e8f\u53ea\u80fd\u68c0\u6d4b\u7eaf\u7cb9\u7684\u5b57\u7b26\u4e32\uff0c\u771f\u6b63\u7684\u56de\u6587\u5b57\u7b26\u68c0\u6d4b\u7a0b\u5e8f\u5e94\u5f53\u80fd\u591f\u5904\u7406\u6807\u70b9\uff0c\u7a7a\u683c\u548c\u5927\u5c0f\u5199\u3002\n", - "\n", - "\u4f8b\u5982\"Rise to vote, sir.\"\u5b9e\u9645\u4e0a\u4e5f\u662f\u56de\u6587\u5b57\u7b26\u4e32\uff0c\u4f46\u662f\u521a\u521a\u7684\u7a0b\u5e8f\u5224\u5b9a\u4ed6\u4e0d\u662f\u3002\n", - "\n", - "\u8bf7\u5199\u51fa\u4e00\u4e2a\u65b0\u7684\u7248\u672c\u3002\n", - "\n", - "\u7b80\u5355\u8d77\u89c1\uff0c\u53ea\u9700\u8981\u5904\u7406,\u548c.\u5373\u53ef\u3002\u5148\u4e0d\u7528\u7ba1\u7406\u5404\u79cd\u590d\u6742\u6807\u70b9\uff0c\u4f8b\u5982&\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "setprofile\n", + "settrace\n" ] - }, + } + ], + "source": [ + "import sys\n", + "for name in dir(sys):\n", + " if name.startswith('s') and name.endswith('e'):\n", + " print(name)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "# 内置数据结构\n", + "\n", + "* list\n", + "* tuple\n", + "* dict\n", + "* set\n", + "* string" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## list\n", + "\n", + "具有顺序的一组对象。\n", + "\n", + "可以随意访问其中的任意位置。\n", + "\n", + "可以添加和删除。\n", + "\n", + "其中的元素不需要是同类型。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "source": [ + "原书例子有问题,那是python3的代码。" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "I have 4 items to purchase.\n", + "These items are: apple mango carrot banana \n", + "I also have to buy rice.\n", + "My shopping list is now ['apple', 'mango', 'carrot', 'banana', 'rice']\n", + "I will sort my list now\n", + "Sorted shopping list is ['apple', 'banana', 'carrot', 'mango', 'rice']\n", + "The first item I will buy is apple\n", + "I bought the apple\n", + "My shopping list is now ['banana', 'carrot', 'mango', 'rice']\n" + ] + } + ], + "source": [ + "import sys\n", + "shoplist = ['apple', 'mango', 'carrot', 'banana']\n", + "\n", + "print('I have {} items to purchase.'.format(len(shoplist)))\n", + "sys.stdout.write('These items are: ')\n", + "for item in shoplist:\n", + " sys.stdout.write(str(item) + ' ')\n", + "\n", + "print('\\nI also have to buy rice.')\n", + "shoplist.append('rice')\n", + "print('My shopping list is now {0}'.format(shoplist))\n", + "\n", + "print('I will sort my list now')\n", + "shoplist.sort()\n", + "print('Sorted shopping list is {0}'.format(shoplist))\n", + "\n", + "print('The first item I will buy is {0}'.format(shoplist[0]))\n", + "olditem = shoplist[0]\n", + "del shoplist[0]\n", + "print('I bought the {0}'.format(olditem))\n", + "print('My shopping list is now {0}'.format(shoplist))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## tuple\n", + "\n", + "具有顺序的一组对象。\n", + "\n", + "可以随意访问其中的任意位置。\n", + "\n", + "不可以添加和删除。\n", + "\n", + "其中的元素不需要是同类型。" + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Number of animals in the zoo is 3\n", + "Number of cages in the new zoo is 3\n", + "All animals in new zoo are ('monkey', 'camel', ('python', 'elephant', 'penguin'))\n", + "Animals brought from old zoo are ('python', 'elephant', 'penguin')\n", + "Last animal brought from old zoo is penguin\n", + "Number of animals in the new zoo is 5\n" + ] + } + ], + "source": [ + "zoo = ('python', 'elephant', 'penguin')\n", + "print('Number of animals in the zoo is {0}'.format(len(zoo)))\n", + "\n", + "new_zoo = 'monkey', 'camel', zoo\n", + "print('Number of cages in the new zoo is {0}'.format(len(new_zoo)))\n", + "\n", + "print('All animals in new zoo are {0}'.format(new_zoo))\n", + "print('Animals brought from old zoo are {0}'.format(new_zoo[2]))\n", + "print('Last animal brought from old zoo is {0}'.format(new_zoo[2][2]))\n", + "print('Number of animals in the new zoo is {0}'.format(len(new_zoo)-1+len(new_zoo[2])))" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } + "data": { + "text/plain": [ + "(1, 2, 3)" + ] }, - "source": [ - "## \u7b54\u6848" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "try:\n", - " input = raw_input\n", - "except NameError:\n", - " pass\n", - "\n", - "def reverse(text):\n", - " return text[::-1]\n", - "\n", - "def is_palindrome(text):\n", - " text = text.replace(',', '')\n", - " text = text.replace('.', '')\n", - " text = text.replace(' ', '')\n", - " text = text.lower()\n", - " return text == reverse(text)\n", - "\n", - "something = input(\"Enter text: \")\n", - "\n", - "if is_palindrome(something):\n", - " print(\"Yes, it is a palindrome\")\n", - "else:\n", - " print(\"No, it is not a palindrome\")" - ], - "language": "python", + "execution_count": 73, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter text: Rise to vote, sir.\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Yes, it is a palindrome\n" - ] - } - ], - "prompt_number": 107 - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u4ece\u6587\u4ef6\u4e2d\u8f93\u5165\u8f93\u51fa\n", - "\n", - "\u4f7f\u7528open\u6253\u5f00\u6587\u4ef6\u8fdb\u884c\u8bfb\u5199\u3002\u8c03\u7528\u65b9\u6cd5\u548cC\u7684fopen\u7c7b\u4f3c\u3002" + "output_type": "execute_result" + } + ], + "source": [ + "r = 1, 2, 3\n", + "r" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1\n", + "2\n", + "3\n" ] - }, + } + ], + "source": [ + "a, b, c = r\n", + "print(a)\n", + "print(b)\n", + "print(c)" + ] + }, + { + "cell_type": "code", + "execution_count": 75, + "metadata": {}, + "outputs": [ { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "poem = '''\\\n", - "Programming is fun\n", - "When the work is done\n", - "if you wanna make your work also fun:\n", - " use Python!\n", - "'''\n", - "f = open('poem.txt', 'w')\n", - "f.write(poem)\n", - "f.close()\n", - "\n", - "f = open('poem.txt')\n", - "while True:\n", - " line = f.readline()\n", - " if len(line) == 0:\n", - " break\n", - " sys.stdout.write(line)\n", - "f.close()" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Programming is fun\n", - "When the work is done\n", - "if you wanna make your work also fun:\n", - " use Python!\n" - ] - } - ], - "prompt_number": 108 - }, + "name": "stdout", + "output_type": "stream", + "text": [ + "2\n", + "1\n" + ] + } + ], + "source": [ + "a, b = b, a\n", + "print(a)\n", + "print(b)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 操作序列对象\n", + "\n", + "* 通过[]访问\n", + "* 通过[]设定值\n", + "* 通过for枚举\n", + "* 通过[:]访问\n", + "* 通过[:]设定值\n", + "* 通过[::]设定步进" + ] + }, + { + "cell_type": "code", + "execution_count": 76, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Item 0 is apple\n", + "Item 1 is mango\n", + "Item 2 is carrot\n", + "Item 3 is banana\n", + "Item -1 is banana\n", + "Item -2 is carrot\n", + "Character 0 is s\n", + "Item 1 to 3 is ['mango', 'carrot']\n", + "Item 2 to end is ['carrot', 'banana']\n", + "Item 1 to -1 is ['mango', 'carrot']\n", + "Item start to end is ['apple', 'mango', 'carrot', 'banana']\n", + "characters 1 to 3 is wa\n", + "characters 2 to end is aroop\n", + "characters 1 to -1 is waroo\n", + "characters start to end is swaroop\n", + "reversed characters is pooraws\n" + ] + } + ], + "source": [ + "shoplist = ['apple', 'mango', 'carrot', 'banana']\n", + "name = 'swaroop'\n", + "print('Item 0 is {0}'.format(shoplist[0]))\n", + "print('Item 1 is {0}'.format(shoplist[1]))\n", + "print('Item 2 is {0}'.format(shoplist[2]))\n", + "print('Item 3 is {0}'.format(shoplist[3]))\n", + "print('Item -1 is {0}'.format(shoplist[-1]))\n", + "print('Item -2 is {0}'.format(shoplist[-2]))\n", + "print('Character 0 is {0}'.format(name[0]))\n", + "\n", + "print('Item 1 to 3 is {0}'.format(shoplist[1:3]))\n", + "print('Item 2 to end is {0}'.format(shoplist[2:]))\n", + "print('Item 1 to -1 is {0}'.format(shoplist[1:-1]))\n", + "print('Item start to end is {0}'.format(shoplist[:]))\n", + "print('characters 1 to 3 is {0}'.format(name[1:3]))\n", + "print('characters 2 to end is {0}'.format(name[2:]))\n", + "print('characters 1 to -1 is {0}'.format(name[1:-1]))\n", + "print('characters start to end is {0}'.format(name[:]))\n", + "print('reversed characters is {0}'.format(name[::-1]))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 练习\n", + "\n", + "1. 建立一个list,内容为10以内的所有质数。\n", + "2. 计算出100内所有质数的列表。\n", + "3. 将这个列表转为tuple。\n", + "4. 根据上面的tuple,获得反转的tuple。\n", + "5. 将一个list分为两个:第一个list拥有原本list前一半的反向,第二个list拥有原本list后一半的反向。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "source": [ + "埃拉托斯特尼筛法。注意代码实现中的筛法效率是有问题的。主要因为sqrt函数没教过。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 答案" + ] + }, + { + "cell_type": "code", + "execution_count": 77, + "metadata": {}, + "outputs": [ { - "cell_type": "code", - "collapsed": false, - "input": [ - "!ls -l poem.txt" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } + "data": { + "text/plain": [ + "[2, 3, 5, 7]" + ] }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "-rw-r--r-- 1 shell shell 95 10\u6708 28 20:07 poem.txt\r\n" - ] - } - ], - "prompt_number": 109 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "!cat poem.txt" - ], - "language": "python", + "execution_count": 77, "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Programming is fun\r\n", - "When the work is done\r\n", - "if you wanna make your work also fun:\r\n", - " use Python!\r\n" - ] - } - ], - "prompt_number": 110 - }, + "output_type": "execute_result" + } + ], + "source": [ + "primes = [2, 3, 5, 7]\n", + "primes" + ] + }, + { + "cell_type": "code", + "execution_count": 78, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "\u4ee5\u4e0a\u7686\u662flinux\u6307\u4ee4\uff0c\u56e0\u6b64\u4e0d\u80fd\uff08\u4e5f\u4e0d\u9700\u8981\uff09\u5728windows\u4e0a\u6267\u884c\u3002windows\u4e0a\u5bf9\u5e94\u7684\u884c\u4e3a\u4e3adir\uff0ctype\uff0c\u548cdel\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]\n" ] - }, + } + ], + "source": [ + "for i in range(10, 100):\n", + " prime = True\n", + " for j in primes:\n", + " if i % j == 0:\n", + " prime = False\n", + " break\n", + " if prime:\n", + " primes.append(i)\n", + "print(primes)" + ] + }, + { + "cell_type": "code", + "execution_count": 79, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "slide" - } - }, - "source": [ - "# \u5f02\u5e38" + "name": "stdout", + "output_type": "stream", + "text": [ + "(2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97)\n" ] - }, + } + ], + "source": [ + "tuple_primes = tuple(primes)\n", + "print(tuple_primes)" + ] + }, + { + "cell_type": "code", + "execution_count": 80, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7b80\u4ecb\n", - "\n", - "Python\u5141\u8bb8\u5728\u51fa\u73b0\u9519\u8bef\u7684\u65f6\u5019\uff0c\u201c\u629b\u201d\u51fa\u8fd9\u4e2a\u9519\u8bef\u3002\n", - "\n", - "\u9519\u8bef\u6309\u7167\u8c03\u7528\u987a\u5e8f\u4f9d\u6b21\u5411\u4e0a\u627e\uff0c\u627e\u5230\u7b2c\u4e00\u4e2a\u5408\u9002\u7684\u5904\u7406\u65b9\u6cd5\u5bf9\u9519\u8bef\u8fdb\u884c\u5904\u7406\u3002\u5982\u679c\u65e0\u4eba\u5904\u7406\u9519\u8bef\uff0c\u5219\u7a0b\u5e8f\u5d29\u6e83\u3002\n", - "\n", - "\u8fd9\u79cd\u9519\u8bef\u5904\u7406\u673a\u5236\u5141\u8bb8\u8c03\u7528\u8005\u5bf9\u51fd\u6570\u6df1\u5c42\u7684\u9519\u8bef\u8fdb\u884c\u5bb9\u9519\uff0c\u540c\u65f6\u4e2d\u95f4\u6240\u6709\u4ee3\u7801\u5bf9\u8fd9\u4e2a\u8fc7\u7a0b\u65e0\u9700\u5e72\u9884\u3002\n", - "\n", - ">>> Print(\"Hello World\")\n", - " Traceback (most recent call last):\n", - " File \"\", line 1, in \n", - " NameError: name 'Print' is not defined\n", - ">>> print(\"Hello World\")\n", - " Hello World" + "name": "stdout", + "output_type": "stream", + "text": [ + "(97, 89, 83, 79, 73, 71, 67, 61, 59, 53, 47, 43, 41, 37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2)\n" ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "Print(\"Hello World\")" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "ename": "NameError", - "evalue": "name 'Print' is not defined", - "output_type": "pyerr", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mPrint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Hello World\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;31mNameError\u001b[0m: name 'Print' is not defined" - ] - } - ], - "prompt_number": 111 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "print(\"Hello World\")" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Hello World\n" - ] - } - ], - "prompt_number": 112 - }, + } + ], + "source": [ + "print(tuple_primes[::-1])" + ] + }, + { + "cell_type": "code", + "execution_count": 81, + "metadata": { + "slideshow": { + "slide_type": "-" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u5f02\u5e38\u8f93\u51fa\u9605\u8bfb\n", - "\n", - "python\u7684\u5927\u591a\u6570\u9519\u8bef\u4f1a\u4f34\u968f\u629b\u51fa\u5f02\u5e38\u3002\u56e0\u6b64\uff0c\u4e3a\u4e86\u89e3\u51b3\u65e5\u5e38\u5728\u4f7f\u7528\u4e2d\u78b0\u5230\u7684\u79cd\u79cd\u95ee\u9898\uff0c\u6211\u4eec\u9700\u8981\u5b66\u4f1a\u5982\u4f55\u9605\u8bfb\u5f02\u5e38\u3002\n", - "\n", - "\u5f02\u5e38\u8f93\u51fa\u901a\u5e38\u548c\u51fd\u6570\u7684\u8c03\u7528\u987a\u5e8f\u76f8\u540c\uff0c\u548c\u6808\u7684\u987a\u5e8f\u76f8\u53cd\u3002\n", - "\n", - "\u6700\u4e0a\u5c42\u7684\u8c03\u7528\uff08\u6700\u5148\u53d1\u751f\u7684\uff09\u5728\u6700\u4e0a\u9762\uff0c\u6700\u540e\u6267\u884c\u5230\u7684\u5730\u65b9\u5728\u6700\u4e0b\u9762\u3002\u6700\u540e\u4e00\u4e2a\u5f02\u5e38\u884c\u5c31\u662f\u5f02\u5e38\u53d1\u751f\u7684\u7cbe\u786e\u5730\u70b9\u3002\n", - "\n", - "\u6700\u540e\u4e00\u884c\u662f\u5f02\u5e38\u7684\u540d\u5b57\u548c\u53c2\u6570\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "(97, 89, 83, 79, 73, 71, 67, 61, 59, 53, 47, 43, 41, 37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2)\n" ] - }, + } + ], + "source": [ + "print(tuple(reversed(tuple_primes)))" + ] + }, + { + "cell_type": "code", + "execution_count": 82, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "code", - "collapsed": false, - "input": [ - "def layer1():\n", - " print('layer1 called')\n", - " return layer2()\n", - "\n", - "def layer2():\n", - " print('layer2 called')\n", - " raise Exception('arg1', 2)\n", - " return 1\n", - "\n", - "print(layer1())" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } + "data": { + "text/plain": [ + "([37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2],\n", + " [97, 89, 83, 79, 73, 71, 67, 61, 59, 53, 47, 43, 41])" + ] }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "layer1 called\n", - "layer2 called\n" - ] - }, - { - "ename": "Exception", - "evalue": "('arg1', 2)", - "output_type": "pyerr", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mException\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 10\u001b[0;31m \u001b[0;32mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlayer1\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m\u001b[0m in \u001b[0;36mlayer1\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mlayer1\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;32mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'layer1 called'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mlayer2\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 4\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mlayer2\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m\u001b[0m in \u001b[0;36mlayer2\u001b[0;34m()\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mlayer2\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0;32mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'layer2 called'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'arg1'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mException\u001b[0m: ('arg1', 2)" - ] - } - ], - "prompt_number": 113 - }, + "execution_count": 82, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Python2下可以不需要int,因为len结果是整数,整数除法结果是整数。\n", + "# 在Python3,没有int会导致出错。\n", + "list(reversed(primes[:int(len(primes)/2)])), list(reversed(primes[int(len(primes)/2):]))" + ] + }, + { + "cell_type": "code", + "execution_count": 83, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "([37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2],\n", + " [97, 89, 83, 79, 73, 71, 67, 61, 59, 53, 47, 43, 41])" + ] + }, + "execution_count": 83, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "primes[int(len(primes)/2-1)::-1], primes[:int(len(primes)/2-1):-1]" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 列表推导式" + ] + }, + { + "cell_type": "code", + "execution_count": 84, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u5f02\u5e38\u5904\u7406\n", - "\n", - "\u5e38\u89c4\u5f02\u5e38\u5904\u7406\u4ee3\u7801\u6bb5\u9700\u8981\u5305\u542b\u4e09\u90e8\u5206\u5185\u5bb9\uff1a\u88ab\u76d1\u7ba1\u4ee3\u7801\u4f53\uff0c\u9519\u8bef\u7c7b\u578b\u548c\u5f02\u5e38\u5904\u7406\u4ee3\u7801\u4f53\u3002\n", - "\n", - "\u5f53\u88ab\u76d1\u7ba1\u4ee3\u7801\u4f53\u4e2d\u53d1\u751f\u5f02\u5e38\u65f6\uff0c\u5f02\u5e38\u88ab\u5411\u4e0a\u629b\u51fa\u3002\n", - "\n", - "\u5411\u4e0a\u5bfb\u627e\u5904\u7406\u51fd\u6570\u7684\u5f02\u5e38\u5c5e\u4e8e\u5b9a\u4e49\u7684\u8fd9\u4e2a\u9519\u8bef\u7c7b\u7684\u5b50\u7c7b\u65f6\uff0c\u5f02\u5e38\u5904\u7406\u4ee3\u7801\u4f53\u88ab\u8c03\u7528\u3002\n", - "\n", - "\u4e00\u822c\u6765\u8bf4\uff0c\u9664\u975e\u660e\u786e\u77e5\u9053\u786e\u5b9e\u8981\u6355\u83b7\u6240\u6709\u5f02\u5e38\uff0c\u5426\u5219\u4e25\u7981\u7528\u6355\u83b7\u6240\u6709\u5f02\u5e38\u6765\u5904\u7406\u67d0\u79cd\u7279\u5b9a\u95ee\u9898\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "[0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121]\n" ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "try:\n", - " input = raw_input\n", - "except NameError:\n", - " pass\n", - "\n", - "try:\n", - " number = int(input('Enter something --> '))\n", - "except ValueError:\n", - " print('Illegal number')\n", - "else:\n", - " print(number+1)" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter something --> 10.a\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Illegal number\n" - ] - } - ], - "prompt_number": 114 - }, + } + ], + "source": [ + "l = range(12)\n", + "t = [i * i for i in l]\n", + "print(t)" + ] + }, + { + "cell_type": "code", + "execution_count": 85, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u5e38\u89c1\u5f02\u5e38\n", - "\n", - "* AttributeError\n", - "* ImportError\n", - "* IndexError\n", - "* KeyError\n", - "* NameError\n", - "* SyntaxError\n", - "* IndentationError\n", - "* TypeError\n", - "* ValueError" + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 9, 25, 49, 81, 121]\n" ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u629b\u51fa\u5f02\u5e38" + } + ], + "source": [ + "t = [i * i for i in l if i % 2 != 0]\n", + "print(t)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 练习\n", + "\n", + "思考一下,列表推导式是否能够将素数列表直接实现出来?为什么?\n", + "\n", + "然后自己测试一下。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "source": [ + "问题的关键在于"生成列表的时候列表是空的"。所以不能一次性生成,必须渐进。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## dict\n", + "\n", + "具有一系列成对对象。一个叫做key,一个叫做value。\n", + "\n", + "无顺序,key不可重复。\n", + "\n", + "通过其中一个(key)可以唯一确定另外一个(value),反之未必。\n", + "\n", + "可以添加和删除。\n", + "\n", + "其中的元素(包括key和value)不需要是同类型。\n", + "\n", + "key必须是不可变对象。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "source": [ + "1: 注意在某些情况下,dict可表现出内在顺序。但这并不是有序约定。\n", + "\n", + "2: 在Python3.6之后,dict表现出类似于OrderedDict的性质。现阶段可无视这个差异。" + ] + }, + { + "cell_type": "code", + "execution_count": 86, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Swaroop's address is swaroop@swaroopch.com\n", + "There are 3 contacts in the address-book\n", + "Name list: Swaroop, Larry, Matsumoto\n", + "Contact Swaroop at swaroop@swaroopch.com\n", + "Contact Larry at larry@wall.org\n", + "Contact Matsumoto at matz@ruby-lang.org\n", + "Guido's address is guido@python.org\n" ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "def f():\n", - " print(\"I'm ok\")\n", - " raise Exception('actually not')\n", - "\n", - "try:\n", - " f()\n", - "except Exception as err:\n", - " print(err)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "I'm ok\n", - "actually not\n" - ] - } - ], - "prompt_number": 115 - }, + } + ], + "source": [ + "ab = {\n", + " 'Swaroop': 'swaroop@swaroopch.com',\n", + " 'Larry': 'larry@wall.org',\n", + " 'Matsumoto': 'matz@ruby-lang.org',\n", + " 'Spammer': 'spammer@hotmail.com'\n", + "}\n", + "\n", + "print(\"Swaroop's address is {}\".format(ab['Swaroop']))\n", + "del ab['Spammer']\n", + "\n", + "print('There are {} contacts in the address-book'.format(len(ab)))\n", + "print('Name list: %s' % ', '.join(ab))\n", + "for name, address in ab.items():\n", + " print('Contact {} at {}'.format(name, address))\n", + "\n", + "ab['Guido'] = 'guido@python.org'\n", + "if 'Guido' in ab:\n", + " print(\"Guido's address is {}\".format(ab['Guido']))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## set\n", + "\n", + "具有一组对象。无顺序,不可重复。\n", + "\n", + "可以添加和删除。\n", + "\n", + "其中的元素不需要是同类型,但必须是不可变对象。" + ] + }, + { + "cell_type": "code", + "execution_count": 87, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } + "data": { + "text/plain": [ + "True" + ] }, - "source": [ - "## \u81ea\u5b9a\u4e49\u5f02\u5e38" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# \u5fc5\u987b\u81eaException\u4e2d\u7ee7\u627f\n", - "class ShortInputException(Exception):\n", - " '''A user-defined exception class.'''\n", - " def __init__(self, length, atleast):\n", - " Exception.__init__(self)\n", - " self.length = length\n", - " self.atleast = atleast" - ], - "language": "python", + "execution_count": 87, "metadata": {}, - "outputs": [], - "prompt_number": 116 - }, + "output_type": "execute_result" + } + ], + "source": [ + "bri = set(['brazil', 'russia', 'india'])\n", + "bri = {'brazil', 'russia', 'india'}\n", + "'india' in bri" + ] + }, + { + "cell_type": "code", + "execution_count": 88, + "metadata": {}, + "outputs": [ { - "cell_type": "code", - "collapsed": false, - "input": [ - "try:\n", - " input = raw_input\n", - "except NameError:\n", - " pass\n", - "\n", - "try:\n", - " text = input('Enter something --> ')\n", - " if len(text) < 3:\n", - " raise ShortInputException(len(text), 3)\n", - "except ShortInputException as ex:\n", - " print('ShortInputException: The input was {0} long, expected at least {1}'.format(\n", - " ex.length, ex.atleast))\n", - "else:\n", - " print('No exception was raised.')" - ], - "language": "python", + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 88, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter something --> 1\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "ShortInputException: The input was 1 long, expected at least 3\n" - ] - } - ], - "prompt_number": 117 - }, + "output_type": "execute_result" + } + ], + "source": [ + "'usa' in bri" + ] + }, + { + "cell_type": "code", + "execution_count": 89, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## finally\n", - "\n", - "finally\u7528\u4e8e\u201c\u65e0\u8bba\u662f\u5f02\u5e38\u8fd8\u662f\u6b63\u5e38\uff0c\u4ee5\u4e0b\u5185\u5bb9\u5fc5\u7136\u88ab\u6267\u884c\u201d\u7684\u60c5\u51b5\u3002\n", - "\n", - "\u591a\u7528\u4e8e\u6e05\u7406\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "{'china', 'russia', 'brazil', 'india'}\n" ] }, { - "cell_type": "code", - "collapsed": false, - "input": [ - "try:\n", - " input = raw_input\n", - "except NameError:\n", - " pass\n", - "\n", - "try:\n", - " number = int(input('Enter something --> '))\n", - "except ValueError:\n", - " print('Illegal number')\n", - "else:\n", - " print(number+1)\n", - "finally:\n", - " print('(clean up here)')" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } + "data": { + "text/plain": [ + "True" + ] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter something --> 10.a\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Illegal number\n", - "(clean up here)\n" - ] - } - ], - "prompt_number": 118 - }, + "execution_count": 89, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bric = bri.copy()\n", + "bric.add('china')\n", + "print(bric)\n", + "bric.issuperset(bri)" + ] + }, + { + "cell_type": "code", + "execution_count": 90, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## with\n", - "\n", - "with\u53ef\u4ee5\u5728\u63a8\u51fa\u533a\u5757\u65f6\u81ea\u52a8\u5173\u95ed\u6587\u4ef6\uff0c\u800c\u4e14\u5bf9\u5f02\u5e38\u5b89\u5168\uff08\u5f02\u5e38\u5728\u4e0b\u4e00\u8282\u8bb2\uff09\u3002\n", - "\n", - "with\u4e0d\u4ec5\u53ef\u4ee5\u7528\u4e8e\u6587\u4ef6\uff0c\u800c\u4e14\u53ef\u4ee5\u7528\u4e8e\u5f88\u591a\u9700\u8981\u5728\u79bb\u5f00\u533a\u57df\u65f6\u81ea\u52a8\u5173\u95ed\u7684\u5bf9\u8c61\uff0c\u4f8b\u5982\u9501\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "{'china', 'brazil', 'india'}\n" ] }, { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "with open(\"poem.txt\") as f:\n", - " for line in f:\n", - " sys.stdout.write(line)" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "-" - } + "data": { + "text/plain": [ + "{'brazil', 'india'}" + ] }, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Programming is fun\n", - "When the work is done\n", - "if you wanna make your work also fun:\n", - " use Python!\n" - ] - } - ], - "prompt_number": 119 - }, + "execution_count": 90, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bric.remove('russia')\n", + "print(bric)\n", + "bri & bric" + ] + }, + { + "cell_type": "code", + "execution_count": 91, + "metadata": {}, + "outputs": [ { - "cell_type": "code", - "collapsed": false, - "input": [ - "!rm -f poem.txt" - ], - "language": "python", - "metadata": { - "slideshow": { - "slide_type": "skip" - } + "data": { + "text/plain": [ + "{'brazil', 'china', 'india', 'russia'}" + ] }, - "outputs": [], - "prompt_number": 120 - }, + "execution_count": 91, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bri | bric" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## string的一些其他方法\n", + "\n", + "* startswith\n", + "* endswith\n", + "* in\n", + "* find\n", + "* replace\n", + "* upper\n", + "* lower\n", + "* join\n", + "* split" + ] + }, + { + "cell_type": "code", + "execution_count": 92, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Yes, the string starts with \"Swa\"\n", + "Yes, it contains the string \"a\"\n", + "position of the string \"war\" is 1\n", + "the string replace war to peace is Speaceoop\n", + "the string replace o to 0 is Swar00p\n", + "upper case: SWAROOP\n", + "lower case: swaroop\n", + "Brazil_*_Russia_*_India_*_China\n", + "['Brazil', 'Russia', 'India', 'China']\n", + "['Brazil_', '_Russia_', '_India_', '_China']\n" + ] + } + ], + "source": [ + "name = 'Swaroop'\n", + "if name.startswith('Swa'):\n", + " print('Yes, the string starts with \"Swa\"')\n", + "\n", + "if 'a' in name:\n", + " print('Yes, it contains the string \"a\"')\n", + "\n", + "pos = name.find('war')\n", + "if pos != -1:\n", + " print('position of the string \"war\" is %d' % pos)\n", + "\n", + "print(\"the string replace war to peace is %s\" % name.replace('war', 'peace'))\n", + "print(\"the string replace o to 0 is %s\" % name.replace('o', '0'))\n", + "\n", + "print(\"upper case: %s\" % name.upper())\n", + "print(\"lower case: %s\" % name.lower())\n", + "\n", + "delimiter = '_*_'\n", + "mylist = ['Brazil', 'Russia', 'India', 'China']\n", + "print(delimiter.join(mylist))\n", + "\n", + "print(delimiter.join(mylist).split(delimiter))\n", + "print(delimiter.join(mylist).split('*'))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 练习\n", + "\n", + "每个国家都有一定的地区号码,现在我们知道这些国家和地区号码关系:\n", + "\n", + "+30 希腊 +45 丹麦 +51 秘鲁 +65 新加坡 +86 中国\n", + "\n", + "写代码求出以下电话号码里面有几个国家:\n", + "\n", + "+86 1123 +65 1234 +51 2347 +30 9123 +65 1246 +30 2347 +86 2935" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 答案" + ] + }, + { + "cell_type": "code", + "execution_count": 93, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## assert" + "name": "stdout", + "output_type": "stream", + "text": [ + "4\n", + "希腊, 秘鲁, 新加坡, 中国\n" ] - }, + } + ], + "source": [ + "number2country = {\n", + " '+30': u'希腊',\n", + " '+45': u'丹麦',\n", + " '+51': u'秘鲁',\n", + " '+65': u'新加坡',\n", + " '+86': u'中国'\n", + "}\n", + "\n", + "numbers = \"+86 1123 +65 1234 +51 2347 +30 9123 +65 1246 +30 2347 +86 2935\".split()\n", + "country_set = set([number2country[n] for n in numbers if n.startswith('+')])\n", + "\n", + "print(len(country_set))\n", + "# 注意:这里的输出顺序在不同的机器上可能不一样,具体依赖于python的版本和实现。set本身是没有顺序约定的。\n", + "print(', '.join(country_set))" + ] + }, + { + "cell_type": "code", + "execution_count": 94, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "code", - "collapsed": false, - "input": [ - "assert 1 == 0, Exception('of course')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "ename": "AssertionError", - "evalue": "of course", - "output_type": "pyerr", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mAssertionError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32massert\u001b[0m \u001b[0;36m1\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'of course'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;31mAssertionError\u001b[0m: of course" - ] - } - ], - "prompt_number": 121 - }, + "name": "stdout", + "output_type": "stream", + "text": [ + "numbers: ['+86', '1123', '+65', '1234', '+51', '2347', '+30', '9123', '+65', '1246', '+30', '2347', '+86', '2935']\n", + "filtered: ['+86', '+65', '+51', '+30', '+65', '+30', '+86']\n", + "filtered and mapped: 中国, 新加坡, 秘鲁, 希腊, 新加坡, 希腊, 中国\n", + "希腊, 秘鲁, 新加坡, 中国\n" + ] + } + ], + "source": [ + "numbers = \"+86 1123 +65 1234 +51 2347 +30 9123 +65 1246 +30 2347 +86 2935\".split()\n", + "print(\"numbers: %s\" % str(numbers))\n", + "print(\"filtered: %s\" % str([n for n in numbers if n.startswith('+')]))\n", + "print(\"filtered and mapped: %s\" % ', '.join([number2country[n] for n in numbers if n.startswith('+')]))\n", + "country_set = set([number2country[n] for n in numbers if n.startswith('+')])\n", + "print(', '.join(country_set))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "# 面对对象编程" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "source": [ + ""一个苹果加一个苹果是什么?"\n", + "\n", + ""两个苹果。"\n", + "\n", + ""一个雪梨加一个雪梨呢?"\n", + "\n", + ""两个雪梨。"\n", + "\n", + ""一个苹果加一个雪梨呢?"\n", + "\n", + ""......"\n", + "\n", + "虽然妲柯妮丝不知道这和欣赏抽象画有什么关系,但还是敲着额头想了想。\n", + "\n", + ""......两个水果?"\n", + "\n", + ""明白了吧?"冰清灵看着若有所思的妲柯妮丝笑道,"从苹果、雪梨到水果,其实是一个去掉不同的部分,然后把相同的部分进行累加的一个过程。从水果、杯子到‘东西’,也是它们的存在本身,也是一样的道理。"\n", + "\n", + "——XINPINGYE《御天者.星星》" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## class\n", + "\n", + "如何定义类:" + ] + }, + { + "cell_type": "code", + "execution_count": 95, + "metadata": {}, + "outputs": [], + "source": [ + "class Person:\n", + " pass # An empty block" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "如何使用类产生对象:" + ] + }, + { + "cell_type": "code", + "execution_count": 96, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "slide" - } - }, - "source": [ - "# \u6587\u6863" + "name": "stdout", + "output_type": "stream", + "text": [ + "<__main__.person object at 0x7f13cc23b358>\n" ] - }, + } + ], + "source": [ + "p = Person()\n", + "print(p)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 方法\n", + "\n", + "如何定义类的成员方法:" + ] + }, + { + "cell_type": "code", + "execution_count": 97, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u6587\u6863\u83b7\u5f97\u548c\u67e5\u9605\n", - "\n", - "\u5728\u7ebf\u6587\u6863\uff1a\n", - "\n", - "https://docs.python.org/2/\n", - "\n", - "https://docs.python.org/3/ \n", - "\n", - "\u672c\u5730\u6587\u6863\uff1a\u968f\u5b89\u88c5\u7248\u672c\u53d8\u5316\u3002\n", - "\n", - "\u4e24\u8005\u51b2\u7a81\u4ee5\u672c\u5730\u4e3a\u51c6\uff0c\u672c\u5730\u4e00\u5b9a\u5bf9\u5e94\u5b89\u88c5\u4f7f\u7528\u7684\u7248\u672c\u3002\n", - "\n", - "\u5e93\u67e5Library Reference\uff0c\u8fd9\u662f\u6700\u4e3b\u8981\u90e8\u5206\u3002\n", - "\n", - "\u8bed\u6cd5\u7279\u6027\u67e5Language Reference\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello, how are you?\n" ] - }, + } + ], + "source": [ + "class Person:\n", + " def say_hi(self):\n", + " print('Hello, how are you?')\n", + "\n", + "p = Person()\n", + "p.say_hi()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 数据\n", + "\n", + "对象里包含的数据。\n", + "\n", + "可以用.访问。\n", + "\n", + "和方法的主要差别在于。方法需要使用()来调用,而数据不需要。" + ] + }, + { + "cell_type": "code", + "execution_count": 98, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7ec3\u4e60\n", - "\n", - "\u6253\u5f00\u6587\u6863\uff0c\u8bf7\u67e5\u9605itertools.permutations\u7684\u610f\u4e49\uff0c\u53c2\u6570\uff0c\u8fd4\u56de\u503c\uff0c\u7528\u6cd5\uff0c\u6ce8\u610f\u8981\u70b9\u7b49\u4fe1\u606f\u3002\u5e76\u5411\u5927\u5bb6\u89e3\u91ca\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "shell\n", + "hello, shell, how are you?\n" ] - }, + } + ], + "source": [ + "class Person:\n", + " def set_name(self, name):\n", + " self.name = name\n", + "\n", + " def say_hi(self):\n", + " print('hello, {}, how are you?'.format(self.name))\n", + " \n", + "p = Person()\n", + "p.set_name('shell')\n", + "print(p.name)\n", + "p.say_hi()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## self\n", + "\n", + "在python中,成员函数使用"self"来指代对象自身。类似于java和C++中的"this"。\n", + "\n", + "在调用时,p.say_hi()即可。不需要传递p.say_hi(self)或者p.say_hi(p)。\n", + "\n", + "在使用时,需要先将self定义为第一个参数。例如def say_hi(self):。\n", + " \n", + "在函数内使用时,对象的成员需要用self.xx的方式使用,例如self.name。\n", + "\n", + "self不是关键词,也不是强制名称。它只是函数的第一个参数。但是为了保持传统,请不要将他改为其他名称。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## \\_\\_init\\_\\_方法\n", + "\n", + "\\_\\_init\\_\\_是对象的第一个方法,用于初始化对象数据。\n", + "\n", + "\\_\\_init\\_\\_函数是初始化方法,而非构造方法。\n", + "\n", + "在\\_\\_init\\_\\_函数被调用时,self对象已经创建完毕。\n", + "\n", + "在python中,对象的属性可以自由添加删除,不需要先在类里面声明。\n", + "\n", + "一般而言,对象里的所有数据会在\\_\\_init\\_\\_方法中赋值,后面可以变更。\n", + "\n", + "但是不在\\_\\_init\\_\\_中赋值,后面直接赋值创建属性也是合法的。" + ] + }, + { + "cell_type": "code", + "execution_count": 99, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7b2c\u4e09\u65b9\u6587\u6863\u67e5\u8be2\n", - "\n", - "\u6ca1\u6709\u4ec0\u4e48\u56fa\u5b9a\u65b9\u6cd5\u3002\n", - "\n", - "\u5728google\uff08\u6ce8\u610f\uff0c\u4e0d\u662fbaidu\uff09\u4e0a\u641c\u7d22\u5173\u952e\u8bcd\u3002\u627e\u4e00\u4e2a\u6bd4\u8f83\u50cf\u7684\u5b98\u7f51\u3002\u627e\u5230\u6587\u6863\u3002\n", - "\n", - "\u53ef\u4ee5\u53c2\u8003pypi\uff0c\u5f88\u591a\u7b2c\u4e09\u65b9\u5e93\u53ef\u4ee5\u5728\u4e0a\u9762\u627e\u5230\u3002\u91cc\u9762\u5f80\u5f80\u5e26\u6709\u6587\u6863\u5730\u5740\u3002\n", - "\n", - "\u7f3a\u70b9\u662f\uff0cpypi\u4e0a\u641c\u51fa\u6765\u7684\u91cd\u540d\u5e93\u592a\u591a\uff0c\u5f88\u96be\u641e\u6e05\u695a\u54ea\u4e2a\u624d\u662f\u4f60\u8981\u7684\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "Swaroop\n", + "hello, Swaroop, how are you?\n", + "shell\n", + "hello, shell, how are you?\n" + ] + } + ], + "source": [ + "class Person:\n", + " def __init__(self, name):\n", + " self.name = name\n", + "\n", + " def set_name(self, name):\n", + " self.name = name\n", + "\n", + " def say_hi(self):\n", + " print('hello, {}, how are you?'.format(self.name))\n", + "\n", + "p = Person('Swaroop')\n", + "print(p.name)\n", + "p.say_hi()\n", + "\n", + "p.set_name('shell')\n", + "print(p.name)\n", + "p.say_hi()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 练习\n", + "\n", + "定义一个马克杯类,定义一个加水方法和一个喝水方法。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 答案" + ] + }, + { + "cell_type": "code", + "execution_count": 100, + "metadata": {}, + "outputs": [], + "source": [ + "class Mug:\n", + "\n", + " def __init__(self):\n", + " self.water = 0\n", + "\n", + " def drink(self, mass):\n", + " self.water -= mass\n", + "\n", + " def watering(self, mass):\n", + " self.water += mass" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 类成员和对象成员\n", + "\n", + "类和对象分别拥有成员,例如数据和方法。\n", + "\n", + "对象可以引用类成员,例如p.say_hi()。也可以引用对象成员,或者self.name。\n", + "\n", + "当有重名时优先引用对象成员。\n", + "\n", + "类成员在所有对象间共享,而对象成员只是它自己的。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "notes" + } + }, + "source": [ + "这里是否要加个例子说明类和对象变量的优先引用次序。" + ] + }, + { + "cell_type": "code", + "execution_count": 101, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [], + "source": [ + "class Robot:\n", + " \"\"\"Represents a robot, with a name.\"\"\"\n", + "\n", + " # A class variable, counting the number of robots\n", + " population = 0\n", + "\n", + " def __init__(self, name):\n", + " \"\"\"Initializes the data.\"\"\"\n", + " self.name = name\n", + " print(\"(Initializing {})\".format(self.name))\n", + " # When this person is created, the robot\n", + " # adds to the population\n", + " Robot.population += 1\n", + "\n", + " def die(self):\n", + " \"\"\"I am dying.\"\"\"\n", + " print(\"{} is being destroyed!\".format(self.name))\n", + " Robot.population -= 1\n", + " if Robot.population == 0:\n", + " print(\"{} was the last one.\".format(self.name))\n", + " else:\n", + " print(\"There are still {:d} robots working.\".format(\n", + " Robot.population))\n", + "\n", + " def say_hi(self):\n", + " \"\"\"Greeting by the robot.\n", + " Yeah, they can do that.\"\"\"\n", + " print(\"Greetings, my masters call me {}.\".format(self.name))\n", + "\n", + " @classmethod\n", + " def how_many(cls):\n", + " \"\"\"Prints the current population.\"\"\"\n", + " print(\"We have {:d} robots.\".format(cls.population))" + ] + }, + { + "cell_type": "code", + "execution_count": 102, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(Initializing R2-D2)\n", + "Greetings, my masters call me R2-D2.\n", + "We have 1 robots.\n", + "(Initializing C-3PO)\n", + "Greetings, my masters call me C-3PO.\n", + "We have 2 robots.\n", + "\n", + "Robots can do some work here.\n", + "\n", + "Robots have finished their work. So let's destroy them.\n", + "R2-D2 is being destroyed!\n", + "There are still 1 robots working.\n", + "C-3PO is being destroyed!\n", + "C-3PO was the last one.\n", + "We have 0 robots.\n" ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "slide" - } - }, - "source": [ - "# Python2\u548cPython3\u7684\u5dee\u5f02" + } + ], + "source": [ + "droid1 = Robot(\"R2-D2\")\n", + "droid1.say_hi()\n", + "Robot.how_many()\n", + "\n", + "droid2 = Robot(\"C-3PO\")\n", + "droid2.say_hi()\n", + "Robot.how_many()\n", + "\n", + "print(\"\\nRobots can do some work here.\\n\")\n", + "\n", + "print(\"Robots have finished their work. So let's destroy them.\")\n", + "droid1.die()\n", + "droid2.die()\n", + "\n", + "Robot.how_many()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 练习\n", + "\n", + "回想一下,上一节你的定义里是否考虑了马克杯的"最大容量"。如果没有,请加上。\n", + "\n", + "思考一下,"最大容量"是对象属性还是类属性,为什么?" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 答案" + ] + }, + { + "cell_type": "code", + "execution_count": 103, + "metadata": {}, + "outputs": [], + "source": [ + "class Mug:\n", + "\n", + " capacity = 300\n", + "\n", + " def __init__(self):\n", + " self.water = 0\n", + "\n", + " def drink(self, mass):\n", + " self.water -= mass\n", + " if self.water < 0:\n", + " self.water = 0\n", + "\n", + " def watering(self, mass):\n", + " self.water += mass\n", + " if self.water> self.capacity:\n", + " self.water = self.capacity" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 继承\n", + "\n", + "继承关系分为基类和继承类(也叫父类和子类)。\n", + "\n", + "子类可以继承父类的成员。当子类和父类定义同名成员时,优先引用子类的。\n", + "\n", + "原则上说,父类能做的事,子类一定能做(虽然行为可能有差异)。父类能出现的地方,子类一定能出现。\n", + "\n", + "因为子类拥有父类的所有成员。\n", + "\n", + "继承的写法为:\n", + "\n", + " class Person(Animal):\n", + " pass" + ] + }, + { + "cell_type": "code", + "execution_count": 104, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [], + "source": [ + "class SchoolMember:\n", + " '''Represents any school member.'''\n", + " def __init__(self, name, age):\n", + " self.name = name\n", + " self.age = age\n", + " print('(Initialized SchoolMember: {})'.format(self.name))\n", + "\n", + " def tell(self):\n", + " '''Tell my details.'''\n", + " print('Name:\"{}\" Age:\"{}\"'.format(self.name, self.age))\n", + "\n", + "\n", + "class Teacher(SchoolMember):\n", + " '''Represents a teacher.'''\n", + " def __init__(self, name, age, salary):\n", + " SchoolMember.__init__(self, name, age)\n", + " self.salary = salary\n", + " print('(Initialized Teacher: {})'.format(self.name))\n", + "\n", + " def tell(self):\n", + " SchoolMember.tell(self)\n", + " print('Salary: \"{:d}\"'.format(self.salary))" + ] + }, + { + "cell_type": "code", + "execution_count": 105, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(Initialized SchoolMember: Mrs. Shrividya)\n", + "(Initialized Teacher: Mrs. Shrividya)\n", + "(Initialized SchoolMember: Swaroop)\n", + "(Initialized Student: Swaroop)\n", + "\n", + "Name:\"Mrs. Shrividya\" Age:\"40\"\n", + "Salary: \"30000\"\n", + "Name:\"Swaroop\" Age:\"25\"\n", + "Marks: \"75\"\n" ] - }, + } + ], + "source": [ + "class Student(SchoolMember):\n", + " '''Represents a student.'''\n", + " def __init__(self, name, age, marks):\n", + " SchoolMember.__init__(self, name, age)\n", + " self.marks = marks\n", + " print('(Initialized Student: {})'.format(self.name))\n", + "\n", + " def tell(self):\n", + " SchoolMember.tell(self)\n", + " print('Marks: \"{:d}\"'.format(self.marks))\n", + "\n", + "t = Teacher('Mrs. Shrividya', 40, 30000)\n", + "s = Student('Swaroop', 25, 75)\n", + "\n", + "# prints a blank line\n", + "print()\n", + "\n", + "members = [t, s]\n", + "for member in members:\n", + " # Works for both Teachers and Students\n", + " member.tell()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 练习\n", + "\n", + "请为马克杯增加一个"添满"方法,可以求出需要添多少水到加满,并自动为杯子加水。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 答案" + ] + }, + { + "cell_type": "code", + "execution_count": 106, + "metadata": {}, + "outputs": [], + "source": [ + "class Mug(object):\n", + " capacity = 300\n", + "\n", + " def __init__(self):\n", + " self.water = 0\n", + "\n", + " def drink(self, mass):\n", + " self.water -= mass\n", + " if self.water < 0:\n", + " self.water = 0\n", + "\n", + " def watering(self, mass):\n", + " self.water += mass\n", + " if self.water> self.capacity:\n", + " self.water = self.capacity\n", + "\n", + " def full(self):\n", + " mass = self.capacity - self.water\n", + " self.watering(mass)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 练习\n", + "\n", + "请定义一个运动杯类,并同样实现"喝水","加水"和"添满"方法。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 练习\n", + "\n", + "考虑一下,如果"马克杯"和"运动杯"的"喝水"和"添水"行为是不一样的。\n", + "\n", + "那么,"添满"行为是否一样,两边是否可以重用"添满"?\n", + "\n", + "如果可以,怎么做?" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 答案" + ] + }, + { + "cell_type": "code", + "execution_count": 107, + "metadata": { + "slideshow": { + "slide_type": "-" + } + }, + "outputs": [], + "source": [ + "class Cup(object):\n", + "\n", + " def __init__(self):\n", + " self.water = 0\n", + "\n", + " def full(self):\n", + " mass = self.capacity - self.water\n", + " self.watering(mass)\n", + "\n", + "class Mug(Cup):\n", + " capacity = 300\n", + "\n", + " def drink(self, mass):\n", + " self.water -= mass\n", + " if self.water < 0:\n", + " self.water = 0\n", + "\n", + " def watering(self, mass):\n", + " self.water += mass\n", + " if self.water> self.capacity:\n", + " self.water = self.capacity\n", + "\n", + "class SportBottle(Cup):\n", + " capacity = 500\n", + "\n", + " def drink(self, mass):\n", + " self.water -= mass\n", + " if self.water < 0:\n", + " self.water = 0\n", + "\n", + " def watering(self, mass):\n", + " self.water += mass\n", + " if self.water> self.capacity:\n", + " self.water = self.capacity" + ] + }, + { + "cell_type": "code", + "execution_count": 108, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u7b80\u8ff0\n", - "\n", - "Python2\u4e2d\u6709\u5f88\u591a\u56fa\u6709\u7684\u8bbe\u8ba1\u95ee\u9898\uff0c\u4f8b\u5982\uff1a\n", - "\n", - "1. print\u662f\u5185\u7f6e\u5173\u952e\u8bcd\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u5173\u952e\u8bcd\u8d8a\u5c11\u8d8a\u597d\uff0c\u56e0\u4e3a\u5173\u952e\u8bcd\u8d8a\u5c11\uff0c\u8bed\u8a00\u7684\u5185\u6838\u8d8a\u7b80\u6d01\u3002\n", - "2. \u6df7\u540c\u4e86bytes\u548cunicode\u3002\n", - "3. /\u662f\u6574\u6570\u9664\u6cd5\u3002\n", - "\n", - "\u8fd9\u4e9b\u95ee\u9898\u5728Python3\u4e2d\u9010\u6b65\u7ed9\u4e88\u4e86\u4fee\u590d\u3002\n", - "\n", - "\u5e38\u89c4\u6765\u8bf4\uff0c\u4fee\u590d\u95ee\u9898\u6700\u91cd\u8981\u7684\u662f\u201c\u5411\u4e0b\u517c\u5bb9\uff0c\u9010\u6b65\u8fdb\u884c\u201d\u3002\n", - "\n", - "\u7136\u800c\u4e0a\u8ff0\u95ee\u9898\u51e0\u4e4e\u5168\u90e8\u90fd\u662f\u8bed\u8a00\u672c\u8d28\u95ee\u9898\uff0c\u4e0d\u5bf9\u8bed\u8a00\u8fdb\u884c\u4f24\u7b4b\u52a8\u9aa8\u7684\u5927\u6539\u662f\u6ca1\u6709\u529e\u6cd5\u4fee\u590d\u7684\u3002\n", - "\n", - "\u56e0\u6b64Python3\u7684\u9884\u8ba2\u662f\u201c\u4e0d\u548cPython2\u517c\u5bb9\u201d\uff0c\u8fd9\u9020\u6210\u4e86Python\u793e\u533a\u76ee\u524d2/3\u5206\u88c2\u7684\u73b0\u72b6\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "200\n", + "400\n" ] - }, + } + ], + "source": [ + "m = Mug()\n", + "m.full()\n", + "m.drink(100)\n", + "print(m.water)\n", + "\n", + "s = SportBottle()\n", + "s.full()\n", + "s.drink(100)\n", + "print(s.water)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "# 输入输出" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 从命令行输入\n", + "\n", + "Python3使用input从命令行输入。Python2使用raw_input从命令行输入。\n", + "\n", + "两者参数一致,都是一个提示字符串。\n", + "\n", + "在Python2中,input是eval(input),有安全性问题。" + ] + }, + { + "cell_type": "code", + "execution_count": 109, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "Python2\u548cPython3\u6709\u5f88\u591a\u7ec6\u8282\u5dee\u5f02\u3002\u4f46\u662f\u5927\u81f4\u6765\u8bf4\uff0c\u6700\u4e3b\u8981\u5c31\u662f\u4e0a\u9762\u63d0\u5230\u7684\u4e09\u9879\u3002\n", - "\n", - "1. Python2\u7684print\u7531\u5173\u952e\u5b57\u6539\u4e3a\u4e86\u51fd\u6570\u3002\u56e0\u6b64print \u2018xxx\u2019\u7684\u5199\u6cd5\u5c31\u4e0d\u5408\u6cd5\u4e86\u3002\n", - "2. \u5728Python3\u4e2d\uff0c\u6240\u6709\u7684\u5b57\u7b26\u4e32\u9ed8\u8ba4\u90fd\u662funicode\u3002\u8981\u5904\u7406\u539f\u751f\u6570\u636e\u9700\u8981\u7528bytes\u3002\u56e0\u6b64\u5f88\u591a\u5728Python2\u4e2d\u80fd\u591f\u5f88\u65b9\u4fbf\u5c31\u5904\u7406\u8fc7\u53bb\u7684\u5730\u65b9\u9700\u8981\u4ed4\u7ec6\u601d\u8003\u662funicode\u8fd8\u662fbytes\u3002\n", - "3. Python3\u4e2d/\u4e0d\u662f\u6574\u6570\u9664\u6cd5\u3002\n", - "\n", - "\u5728\u4e0b\u9762\u8fd9\u4e2a\u8fde\u63a5\u91cc\uff0c\u6536\u5f55\u4e86Python2\u548cPython3\u7684\u5176\u4ed6\u4e00\u4e9b\u7ec6\u8282\u5dee\u5f02\u3002\n", - "\n", - "https://wiki.python.org/moin/Python2orPython3" + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter text: abc\n", + "No, it is not a palindrome\n" ] - }, + } + ], + "source": [ + "#Rise to vote, sir.\n", + "\n", + "def reverse(text):\n", + " return text[::-1]\n", + "\n", + "def is_palindrome(text):\n", + " return text == reverse(text)\n", + "\n", + "something = input(\"Enter text: \")\n", + "\n", + "if is_palindrome(something):\n", + " print(\"Yes, it is a palindrome\")\n", + "else:\n", + " print(\"No, it is not a palindrome\")" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 练习\n", + "\n", + "刚刚的回文字符串程序只能检测纯粹的字符串,真正的回文字符检测程序应当能够处理标点,空格和大小写。\n", + "\n", + "例如\"Rise to vote, sir.\"实际上也是回文字符串,但是刚刚的程序判定他不是。\n", + "\n", + "请写出一个新的版本。\n", + "\n", + "简单起见,只需要处理,和.即可。先不用管理各种复杂标点,例如&。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 答案" + ] + }, + { + "cell_type": "code", + "execution_count": 110, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## Python2\u52303\u8fc1\u79fb\n", - "\n", - "Python3\u5e26\u67092to3\u811a\u672c\uff0c\u53ef\u4ee5\u5b8c\u6210\u5f88\u591a\u9879\u76ee\u7684\u8fc1\u79fb\u3002\n", - "\n", - "\u4f46\u662f\u5bf9\u4e8e\u67d0\u4e9b\u60c5\u51b5\uff0c\u4ed6\u4ecd\u7136\u4e0d\u80fd\u81ea\u52a8\u7684\u5b8c\u6210\u6240\u6709\u5de5\u4f5c\u3002\n", - "\n", - "2\u52303\u8fc1\u79fb\u7684\u4e3b\u8981\u95ee\u9898\u5728\u4e8e\uff0c\u76ee\u524d\u6709\u5f88\u591a\u5e93\uff0c\u4ecd\u7136\u6ca1\u6709\u5b8c\u6210Python3\u7684\u8fc1\u79fb\u5de5\u4f5c\u3002\u8fd9\u5bfc\u81f4\u4f7f\u7528\u8fd9\u4e9b\u5e93\u7f16\u5199\u7684\u7a0b\u5e8f\u5f88\u96be\u5728Python3\u4e0a\u627e\u5230\u66f4\u597d\u7684\uff08\u6216\u8005\u66f4\u4e60\u60ef\u7684\uff09\u66ff\u4ee3\u4ea7\u54c1\u3002\n", - "\n", - "\u800c\u8fd9\u4ef6\u4e8b\u60c5\u662f2to3\u811a\u672c\u65e0\u6cd5\u81ea\u52a8\u5b8c\u6210\u7684\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter text: Rise to vote, sir.\n", + "Yes, it is a palindrome\n" ] - }, + } + ], + "source": [ + "def reverse(text):\n", + " return text[::-1]\n", + "\n", + "def is_palindrome(text):\n", + " text = text.replace(',', '')\n", + " text = text.replace('.', '')\n", + " text = text.replace(' ', '')\n", + " text = text.lower()\n", + " return text == reverse(text)\n", + "\n", + "something = input(\"Enter text: \")\n", + "\n", + "if is_palindrome(something):\n", + " print(\"Yes, it is a palindrome\")\n", + "else:\n", + " print(\"No, it is not a palindrome\")" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 从文件中输入输出\n", + "\n", + "使用open打开文件进行读写。调用方法和C的fopen类似。" + ] + }, + { + "cell_type": "code", + "execution_count": 111, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u6211\u8be5\u7528\u54ea\u4e2a\u7248\u672c/\u54ea\u4e2a\u66f4\u597d\n", - "\n", - "\u4efb\u4f55\u80fd\u8ba9\u4f60\u4e0d\u6dfb\u52a0\u989d\u5916\u7684\u9ebb\u70e6\u628a\u5de5\u4f5c\u505a\u4e0b\u6765\u7684\u7248\u672c\u90fd\u662f\u597d\u7684\u3002\n", - "\n", - "\u5982\u679cPython2\u548cPython3\u4e00\u6837\u597d\uff0c\u90a3\u4e48Python3\u66f4\u597d\u3002\n", - "\n", - "\u56e0\u4e3a\u5f88\u663e\u7136\uff0cPython\u793e\u533a\u5df2\u7ecf\u5ba3\u5e03Python2\u5c06\u505c\u6b62\u7ef4\u62a4\u3002\u5728\u53ef\u89c1\u7684\u65f6\u95f4\u5185\uff0c\u663e\u7136\u90fd\u8981\u4f7f\u7528Python3\u7684\u5199\u6cd5\u3002\n", - "\n", - "\u5982\u679c\u80fd\u591f\u4e0d\u6dfb\u52a0\u989d\u5916\u9ebb\u70e6\u7684\u60c5\u51b5\u4e0b\u4f7f\u7528Python3\uff0c\u8fd9\u53ef\u80fd\u4e3a\u5c06\u6765\u7684\u7ef4\u62a4\u5e26\u6765\u4fbf\u5229\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "Programming is fun\n", + "When the work is done\n", + "if you wanna make your work also fun:\n", + " use Python!\n" ] - }, + } + ], + "source": [ + "import sys\n", + "poem = '''\\\n", + "Programming is fun\n", + "When the work is done\n", + "if you wanna make your work also fun:\n", + " use Python!\n", + "'''\n", + "f = open('poem.txt', 'w')\n", + "f.write(poem)\n", + "f.close()\n", + "\n", + "f = open('poem.txt')\n", + "while True:\n", + " line = f.readline()\n", + " if len(line) == 0:\n", + " break\n", + " sys.stdout.write(line)\n", + "f.close()" + ] + }, + { + "cell_type": "code", + "execution_count": 112, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "notes" - } - }, - "source": [ - "\u5982\u679c\u4f60\u6b63\u5728\u7ef4\u62a4\u4e00\u4e2a\u73b0\u6709\u7684Python2\u4ee3\u7801\uff08\u81ea\u5df1\u5199\u7684\uff0c\u6216\u8005\u63a5\u624b\u7684\uff09\u3002\u5728\u6ca1\u6709\u660e\u786e\u95ee\u9898\u7684\u60c5\u51b5\u4e0b\uff0c\u4e0d\u5efa\u8bae\u505a2to3\u79fb\u690d\u3002\n", - "\n", - "\u56e0\u4e3a\u79fb\u690d\u9700\u8981\u6210\u672c\uff0c\u800c\u9879\u76ee\u6709\u751f\u5b58\u5468\u671f\u3002\u5f88\u96be\u4fdd\u8bc1\u9879\u76ee\u4e00\u5b9a\u80fd\u591f\u6d3b\u5230\u975e\u8fc1\u4e0d\u53ef\u90a3\u4e00\u5929\u3002\u7b49\u5230\u8fd9\u5929\u6765\u4e34\u65f6\u624d\u8fdb\u884c\u8fc1\u79fb\u4e00\u5b9a\u662f\u6210\u672c\u6700\u5c0f\u7684\u3002\n", - "\n", - "\u5f53\u7136\uff0c\u5982\u679c\u4f9d\u8d56\u4f60\u7684\u4ee3\u7801\u7684\u4eba\u6709Python3\u8fc1\u79fb\u95ee\u9898\uff08\u4f8b\u5982\u8bf4\u662f\u4e00\u4e2a\u5e93\uff0c\u800c\u4e14\u5f88\u5e38\u7528\uff09\uff0c\u8fd9\u660e\u663e\u5c31\u662f\u4e00\u4e2a\u5fc5\u987b\u79fb\u690d\u7684\u60c5\u51b5\u4e86\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "-rw-r--r-- 1 shell shell 95 Mar 22 20:06 poem.txt\r\n" ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "slide" - } - }, - "source": [ - "# \u7b2c\u4e09\u65b9\u8f6f\u4ef6\u5b89\u88c5\n", - "\n", - "\u4e24\u5957\u57fa\u672c\u7cfb\u7edf\uff1a\n", - "\n", - "* setuptools\n", - "* pip" + } + ], + "source": [ + "!ls -l poem.txt" + ] + }, + { + "cell_type": "code", + "execution_count": 113, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Programming is fun\r\n", + "When the work is done\r\n", + "if you wanna make your work also fun:\r\n", + " use Python!\r\n" ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## setuptools\n", - "\n", - "\u7cfb\u7edf\u4e2d\u5fc5\u987b\u5b89\u88c5\u4e86setuptools\uff08\u8bf7\u54a8\u8be2\u7ba1\u7406\u5458\u5b89\u88c5\uff09\uff0c\u6216\u8005\u4f7f\u7528\u4ee5\u4e0b\u6307\u4ee4\u5b89\u88c5\uff1a\n", - "\n", - "Linux:\n", - "\n", - " wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python\n", - "\n", - "MacOS:\n", - "\n", - " curl https://bootstrap.pypa.io/ez_setup.py -o - | python" + } + ], + "source": [ + "!cat poem.txt" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "以上皆是linux指令,因此不能(也不需要)在windows上执行。windows上对应的行为为dir,type,和del。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "# 异常" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 简介\n", + "\n", + "Python允许在出现错误的时候,"抛"出这个错误。\n", + "\n", + "错误按照调用顺序依次向上找,找到第一个合适的处理方法对错误进行处理。如果无人处理错误,则程序崩溃。\n", + "\n", + "这种错误处理机制允许调用者对函数深层的错误进行容错,同时中间所有代码对这个过程无需干预。\n", + "\n", + ">>> Print(\"Hello World\")\n", + " Traceback (most recent call last):\n", + " File \"\", line 1, in \n", + " NameError: name 'Print' is not defined\n", + ">>> print(\"Hello World\")\n", + " Hello World" + ] + }, + { + "cell_type": "code", + "execution_count": 114, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'Print' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mPrint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Hello World\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mNameError\u001b[0m: name 'Print' is not defined" ] - }, + } + ], + "source": [ + "Print(\"Hello World\")" + ] + }, + { + "cell_type": "code", + "execution_count": 115, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## setuptools\u7684\u4f7f\u7528\n", - "\n", - "1. easy_install \u5305\u540d\n", - "2. easy_install \u5b89\u88c5\u5305\u8def\u5f84\u3002\uff08\u8def\u5f84\u53ef\u4ee5\u586b\u5199\u4e00\u4e2aurl\uff0c\u7cfb\u7edf\u4f1a\u4ece\u7f51\u7edc\u4e0a\u4e0b\u8f7d\u5b89\u88c5\uff09\n", - "3. \u5728\u8f6f\u4ef6\u7684\u5206\u53d1\u5305\u4e2d\u627e\u5230setup.py\uff0c\u76f4\u63a5\u8fd0\u884cpython setup.py install\n", - "\n", - "\u8fdb\u4e00\u6b65\u8d44\u6599\u8bf7\u53c2\u8003\uff1ahttps://setuptools.readthedocs.io/en/latest/easy_install.html" + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World\n" ] - }, + } + ], + "source": [ + "print(\"Hello World\")" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 异常输出阅读\n", + "\n", + "python的大多数错误会伴随抛出异常。因此,为了解决日常在使用中碰到的种种问题,我们需要学会如何阅读异常。\n", + "\n", + "异常输出通常和函数的调用顺序相同,和栈的顺序相反。\n", + "\n", + "最上层的调用(最先发生的)在最上面,最后执行到的地方在最下面。最后一个异常行就是异常发生的精确地点。\n", + "\n", + "最后一行是异常的名字和参数。" + ] + }, + { + "cell_type": "code", + "execution_count": 116, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## pip\n", - "\n", - "\u7cfb\u7edf\u4e2d\u5fc5\u987b\u6709pip\uff0c\u5177\u4f53\u8bf7\u54a8\u8be2\u7ba1\u7406\u5458\u3002\u6216\u8005\u4e0b\u8f7d\u8be5\u6587\u4ef6\uff1a\n", - "\n", - "https://bootstrap.pypa.io/get-pip.py\n", - "\n", - "\u4f7f\u7528python\u6267\u884c\u5b89\u88c5\uff08\u6ce8\u610f\u9700\u8981\u7ba1\u7406\u5458\u6743\u9650\uff09\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "layer1 called\n", + "layer2 called\n" ] }, { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## pip\u7684\u4f7f\u7528\n", - "\n", - "1. pip install \u5305\u540d\n", - "2. pip install -r requirements.txt \uff08\u81ea\u52a8\u5904\u7406\u91cc\u9762\u7684\u6240\u6709\u4f9d\u8d56\uff09" + "ename": "Exception", + "evalue": "('arg1', 2)", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mException\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 10\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlayer1\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m\u001b[0m in \u001b[0;36mlayer1\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mlayer1\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'layer1 called'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mlayer2\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 4\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mlayer2\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m\u001b[0m in \u001b[0;36mlayer2\u001b[0;34m()\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mlayer2\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'layer2 called'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'arg1'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mException\u001b[0m: ('arg1', 2)" ] - }, + } + ], + "source": [ + "def layer1():\n", + " print('layer1 called')\n", + " return layer2()\n", + "\n", + "def layer2():\n", + " print('layer2 called')\n", + " raise Exception('arg1', 2)\n", + " return 1\n", + "\n", + "print(layer1())" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 异常处理\n", + "\n", + "常规异常处理代码段需要包含三部分内容:被监管代码体,错误类型和异常处理代码体。\n", + "\n", + "当被监管代码体中发生异常时,异常被向上抛出。\n", + "\n", + "向上寻找处理函数的异常属于定义的这个错误类的子类时,异常处理代码体被调用。\n", + "\n", + "一般来说,除非明确知道确实要捕获所有异常,否则严禁用捕获所有异常来处理某种特定问题。" + ] + }, + { + "cell_type": "code", + "execution_count": 117, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## virtualenv\n", - "\n", - "\u529f\u80fd\uff1a\u7528\u4e8e\u9694\u79bb\u51fa\u4e00\u5957\u72ec\u7acb\u7684\u73af\u5883\uff0c\u53ef\u4ee5\u5728\u91cc\u9762\u5b89\u88c5\u5404\u79cd\u5305\uff0c\u800c\u4e0d\u5bf9\u7cfb\u7edf\u9020\u6210\u5f71\u54cd\u3002\n", - "\n", - "\u4f7f\u7528\u573a\u666f\uff1a\u53ef\u4ee5\u5728\u7528\u6237\u76ee\u5f55\u4e2d\u5b89\u88c5\u5305\uff0c\u65e0\u9700\u7cfb\u7edf\u6743\u9650\u3002\u4e5f\u53ef\u4ee5\u9694\u79bb\u591a\u4e2a\u73af\u5883\uff0c\u5b89\u88c5\u4e0d\u540c\u7248\u672c\u7684\u4e0d\u540c\u7a0b\u5e8f\u3002\n", - "\n", - "\u9650\u5236\uff1avirtualenv\u672c\u8eab\uff0c\u53ca\u5176\u4f9d\u8d56\u7684Python\u662f\u65e0\u6cd5\u9694\u79bb\u7684\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter something --> abc\n", + "Illegal number\n" ] - }, + } + ], + "source": [ + "try:\n", + " number = int(input('Enter something --> '))\n", + "except ValueError:\n", + " print('Illegal number')\n", + "else:\n", + " print(number+1)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 常见异常\n", + "\n", + "* AttributeError\n", + "* ImportError\n", + "* IndexError\n", + "* KeyError\n", + "* NameError\n", + "* SyntaxError\n", + "* IndentationError\n", + "* TypeError\n", + "* ValueError" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 抛出异常" + ] + }, + { + "cell_type": "code", + "execution_count": 118, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## virtualenv\u7684\u4f7f\u7528\n", - "\n", - "\u5efa\u7acb\u73af\u5883\uff1avirtualenv \u76ee\u5f55\u540d\n", - "\n", - "\u6fc0\u6d3b\u73af\u5883\uff1a\u8fdb\u5165\u76ee\u5f55\u540e\u6267\u884csource bin/activate\n", - "\n", - "\u9000\u51fa\u6fc0\u6d3b\u73af\u5883\uff1adeactivate\n", - "\n", - "\u9694\u79bb\u73af\u5883\u5185\u7684\u5b89\u88c5\uff1apip\u6216\u8005setup.py\u5747\u53ef\n", - "\n", - "\u6ce8\u610f\uff1a\u5b89\u88c5\u5e93\u65f6\u9700\u8981\u7f16\u8bd1\u7684\uff0c\u7cfb\u7edf\u4e2d\u5fc5\u987b\u6709\u7f16\u8bd1\u5de5\u5177\u94fe\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "I'm ok\n", + "actually not\n" ] - }, + } + ], + "source": [ + "def f():\n", + " print(\"I'm ok\")\n", + " raise Exception('actually not')\n", + "\n", + "try:\n", + " f()\n", + "except Exception as err:\n", + " print(err)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 自定义异常" + ] + }, + { + "cell_type": "code", + "execution_count": 119, + "metadata": {}, + "outputs": [], + "source": [ + "# 必须自Exception中继承\n", + "class ShortInputException(Exception):\n", + " '''A user-defined exception class.'''\n", + " def __init__(self, length, atleast):\n", + " Exception.__init__(self)\n", + " self.length = length\n", + " self.atleast = atleast" + ] + }, + { + "cell_type": "code", + "execution_count": 120, + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u8bbf\u95ee\u7cfb\u7edf\u5e93\n", - "\n", - "\u5982\u679c\u5728\u4f7f\u7528virtualenv\u7684\u540c\u65f6\uff0c\u4e5f\u60f3\u4f7f\u7528\u7cfb\u7edf\u4e2d\u5b89\u88c5\u7684\u5e93\u3002\u90a3\u4e48\u9700\u8981\u5728\u521b\u5efa\u73af\u5883\u65f6\u7528--system-site-packages\u53c2\u6570\u3002\n", - "\n", - "\u4ece\u5de5\u7a0b\u7ba1\u7406\u89d2\u5ea6\uff0c\u6211\u4eec\u4e0d\u63a8\u8350\u8fd9\u79cd\u529e\u6cd5\u3002\u5efa\u8bae\u5c06\u7cfb\u7edf\u4e2d\u7684\u6240\u6709\u5e93\u5728\u865a\u73af\u5883\u4e2d\u518d\u5b89\u88c5\u4e00\u6b21\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter something --> a\n", + "ShortInputException: The input was 1 long, expected at least 3\n" ] - }, + } + ], + "source": [ + "try:\n", + " text = input('Enter something --> ')\n", + " if len(text) < 3:\n", + " raise ShortInputException(len(text), 3)\n", + "except ShortInputException as ex:\n", + " print('ShortInputException: The input was {0} long, expected at least {1}'.format(\n", + " ex.length, ex.atleast))\n", + "else:\n", + " print('No exception was raised.')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## finally\n", + "\n", + "finally用于"无论是异常还是正常,以下内容必然被执行"的情况。\n", + "\n", + "多用于清理。" + ] + }, + { + "cell_type": "code", + "execution_count": 121, + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u865a\u62df\u73af\u5883\u7684\u53d1\u5e03\n", - "\n", - "\u4f7f\u7528virtualenv\u751f\u6210\u7684\u865a\u62df\u73af\u5883\u53ef\u4ee5\u8fc1\u79fb\u5230\u5176\u4ed6\u673a\u5668\u4e0a\uff0c\u4ece\u800c\u5141\u8bb8\u5c06\u8fd0\u884c\u73af\u5883\u5728\u591a\u53f0\u673a\u5668\u4e0a\u8fc1\u79fb\u3002\u4f46\u662f\u9700\u8981\u6ce8\u610f\u4ee5\u4e0b\u4e8b\u9879\uff1a\n", - "\n", - "* virtualenv\u4f9d\u8d56\u4e8e\u76ee\u5f55\u5de5\u4f5c\uff0c\u6240\u4ee5\u6240\u6709\u673a\u5668\u4e0avirtualenv\u5fc5\u987b\u5904\u4e8e\u540c\u4e00\u8def\u5f84\u4e0b\u3002\n", - "* virtualenv\u4e0d\u80fd\u9694\u79bb\u7cfb\u7edf/Python\u57fa\u7840\u73af\u5883\u3002\u56e0\u6b64\u6240\u6709\u673a\u5668\u5fc5\u987b\u540c\u6784\uff0c\u5e76\u4e14Python\u73af\u5883\u57fa\u672c\u4e00\u81f4\u3002\n", - "* \u91cc\u9762\u6240\u5b89\u88c5\u7684\u5e93\u6240\u4f9d\u8d56\u7684\u5176\u4ed6\u7cfb\u7edf\u6587\u4ef6\uff0c\u4f8b\u5982\u52a8\u6001\u8fd0\u884c\u5e93\uff0c\u6570\u636e\u6587\u4ef6\u3002\u5982\u679c\u4e0d\u5728virtualenv\u91cc\u5b89\u88c5\u7684\uff0c\u5219\u6bcf\u4e2a\u7cfb\u7edf\u4e0a\u5747\u9700\u8981\u81ea\u884c\u5b89\u88c5\u3002" + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter something --> abc\n", + "Illegal number\n", + "(clean up here)\n" ] - }, + } + ], + "source": [ + "try:\n", + " number = int(input('Enter something --> '))\n", + "except ValueError:\n", + " print('Illegal number')\n", + "else:\n", + " print(number+1)\n", + "finally:\n", + " print('(clean up here)')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## with\n", + "\n", + "with可以在推出区块时自动关闭文件,而且对异常安全(异常在下一节讲)。\n", + "\n", + "with不仅可以用于文件,而且可以用于很多需要在离开区域时自动关闭的对象,例如锁。" + ] + }, + { + "cell_type": "code", + "execution_count": 122, + "metadata": { + "slideshow": { + "slide_type": "-" + } + }, + "outputs": [ { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u66f4\u8fdb\u4e00\u6b65\u8d44\u6599\n", - "\n", - "\u8bf7\u53c2\u8003\u8fd9\u91cc\uff1a\n", - "\n", - "https://virtualenv.pypa.io/en/stable/userguide/" + "name": "stdout", + "output_type": "stream", + "text": [ + "Programming is fun\n", + "When the work is done\n", + "if you wanna make your work also fun:\n", + " use Python!\n" ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "subslide" - } - }, - "source": [ - "## \u8f6f\u4ef6\u5305\u5b89\u88c5\u548c\u7ba1\u7406\u5efa\u8bae\n", - "\n", - "Python\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4f1a\u8bd5\u56fe\u5c06\u8f6f\u4ef6\u5305\u5b89\u88c5\u5230\u7cfb\u7edf\u91cc\uff0c\u5982\u679c\u4e0d\u5177\u5907\u7ba1\u7406\u5458\u6743\u9650\uff0c\u9700\u8981\u4f7f\u7528virtualenv\u6765\u5b89\u88c5\u8f6f\u4ef6\u5305\u3002\n", - "\n", - "\u5bf9\u4e8eDebian/Ubuntu\u800c\u8a00\uff0c\u5b89\u88c5\u8f6f\u4ef6\u7684\u7b2c\u4e00\u9009\u62e9\u662fapt\u7cfb\u7edf\u3002\u5982\u679c\u627e\u4e0d\u5230\u5305\uff0c\u6216\u7248\u672c\u4e0d\u5bf9\uff0c\u5efa\u8bae\u91c7\u7528virtualenv + pip\u7684\u65b9\u5f0f\u5b89\u88c5\u3002\n", - "\n", - "\u5bf9\u4e8eRHEL/CentOS\u800c\u8a00\uff0c\u5b89\u88c5\u8f6f\u4ef6\u7684\u7b2c\u4e00\u9009\u62e9\u662fyum\u7cfb\u7edf\u3002\u5982\u679c\u627e\u4e0d\u5230\u5305\uff0c\u6216\u7248\u672c\u4e0d\u5bf9\uff0c\u5efa\u8bae\u91c7\u7528virtualenv + pip\u7684\u65b9\u5f0f\u5b89\u88c5\u3002\n", - "\n", - "\u5bf9\u4e8eWindows/MacOS\u800c\u8a00\uff0c\u5efa\u8bae\u4f7f\u7528virtualenv + pip\u7684\u65b9\u5f0f\u5b89\u88c5\u3002" + } + ], + "source": [ + "import sys\n", + "with open(\"poem.txt\") as f:\n", + " for line in f:\n", + " sys.stdout.write(line)" + ] + }, + { + "cell_type": "code", + "execution_count": 123, + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "outputs": [], + "source": [ + "!rm -f poem.txt" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## assert" + ] + }, + { + "cell_type": "code", + "execution_count": 124, + "metadata": {}, + "outputs": [ + { + "ename": "AssertionError", + "evalue": "of course", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mAssertionError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32massert\u001b[0m \u001b[0;36m1\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'of course'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mAssertionError\u001b[0m: of course" ] } ], - "metadata": {} + "source": [ + "assert 1 == 0, Exception('of course')" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "# 文档" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 文档获得和查阅\n", + "\n", + "在线文档:\n", + "\n", + "https://docs.python.org/3/\n", + "\n", + "本地文档:随安装版本变化。\n", + "\n", + "两者冲突以本地为准,本地一定对应安装使用的版本。\n", + "\n", + "库查Library Reference,这是最主要部分。\n", + "\n", + "语法特性查Language Reference。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 练习\n", + "\n", + "打开文档,请查阅itertools.permutations的意义,参数,返回值,用法,注意要点等信息。并向大家解释。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 第三方文档查询\n", + "\n", + "没有什么固定方法。\n", + "\n", + "在google(注意,不是baidu)上搜索关键词。找一个比较像的官网。找到文档。\n", + "\n", + "可以参考pypi,很多第三方库可以在上面找到。里面往往带有文档地址。\n", + "\n", + "缺点是,pypi上搜出来的重名库太多,很难搞清楚哪个才是你要的。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "# Python2和Python3的差异" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 简述\n", + "\n", + "Python2中有很多固有的设计问题,例如:\n", + "\n", + "1. print是内置关键词。一般来说,关键词越少越好,因为关键词越少,语言的内核越简洁。\n", + "2. 混同了bytes和unicode。\n", + "3. /是整数除法。\n", + "\n", + "这些问题在Python3中逐步给予了修复。\n", + "\n", + "常规来说,修复问题最重要的是"向下兼容,逐步进行"。\n", + "\n", + "然而上述问题几乎全部都是语言本质问题,不对语言进行伤筋动骨的大改是没有办法修复的。\n", + "\n", + "因此Python3的预订是"不和Python2兼容",这造成了Python社区目前2/3分裂的现状。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "Python2和Python3有很多细节差异。但是大致来说,最主要就是上面提到的三项。\n", + "\n", + "1. Python2的print由关键字改为了函数。因此print ‘xxx’的写法就不合法了。\n", + "2. 在Python3中,所有的字符串默认都是unicode。要处理原生数据需要用bytes。因此很多在Python2中能够很方便就处理过去的地方需要仔细思考是unicode还是bytes。\n", + "3. Python3中/不是整数除法。\n", + "\n", + "在下面这个连接里,收录了Python2和Python3的其他一些细节差异。\n", + "\n", + "https://wiki.python.org/moin/Python2orPython3" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## Python2到3迁移\n", + "\n", + "Python3带有2to3脚本,可以完成很多项目的迁移。\n", + "\n", + "但是对于某些情况,他仍然不能自动的完成所有工作。\n", + "\n", + "2到3迁移的主要问题在于,目前有很多库,仍然没有完成Python3的迁移工作。这导致使用这些库编写的程序很难在Python3上找到更好的(或者更习惯的)替代产品。\n", + "\n", + "而这件事情是2to3脚本无法自动完成的。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 我该用哪个版本/哪个更好\n", + "\n", + "由于Python2已经停止维护,因此新开项目时请一律使用Python3。\n", + "\n", + "教材教授了很多Python2写法,主要是考虑到接手项目中可能有大量遗留代码。对于这些代码,读懂维护是必要技能。\n", + "\n", + "对现存代码。如果预期会被长期维护的,建议将代码迁移到Python3中。如果代码生命期不长,短期维护Python2代码也可接受。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "# 第三方软件安装\n", + "\n", + "两套基本系统:\n", + "\n", + "* setuptools\n", + "* pip" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## setuptools\n", + "\n", + "系统中必须安装了setuptools(请咨询管理员安装),或者使用以下指令安装:\n", + "\n", + "Linux:\n", + "\n", + " wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python\n", + "\n", + "MacOS:\n", + "\n", + " curl https://bootstrap.pypa.io/ez_setup.py -o - | python" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## setuptools的使用\n", + "\n", + "1. easy_install 包名\n", + "2. easy_install 安装包路径。(路径可以填写一个url,系统会从网络上下载安装)\n", + "3. 在软件的分发包中找到setup.py,直接运行python setup.py install\n", + "\n", + "进一步资料请参考:https://setuptools.readthedocs.io/en/latest/easy_install.html" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## pip\n", + "\n", + "系统中必须有pip,具体请咨询管理员。或者下载该文件:\n", + "\n", + "https://bootstrap.pypa.io/get-pip.py\n", + "\n", + "使用python执行安装(注意需要管理员权限)。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## pip的使用\n", + "\n", + "1. pip install 包名\n", + "2. pip install -r requirements.txt (自动处理里面的所有依赖)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## virtualenv\n", + "\n", + "功能:用于隔离出一套独立的环境,可以在里面安装各种包,而不对系统造成影响。\n", + "\n", + "使用场景:可以在用户目录中安装包,无需系统权限。也可以隔离多个环境,安装不同版本的不同程序。\n", + "\n", + "限制:virtualenv本身,及其依赖的Python是无法隔离的。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## virtualenv的使用\n", + "\n", + "建立环境:virtualenv 目录名\n", + "\n", + "激活环境:进入目录后执行source bin/activate\n", + "\n", + "退出激活环境:deactivate\n", + "\n", + "隔离环境内的安装:pip或者setup.py均可\n", + "\n", + "注意:安装库时需要编译的,系统中必须有编译工具链。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 访问系统库\n", + "\n", + "如果在使用virtualenv的同时,也想使用系统中安装的库。那么需要在创建环境时用--system-site-packages参数。\n", + "\n", + "从工程管理角度,我们不推荐这种办法。建议将系统中的所有库在虚环境中再安装一次。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 虚拟环境的发布\n", + "\n", + "使用virtualenv生成的虚拟环境可以迁移到其他机器上,从而允许将运行环境在多台机器上迁移。但是需要注意以下事项:\n", + "\n", + "* virtualenv依赖于目录工作,所以所有机器上virtualenv必须处于同一路径下。\n", + "* virtualenv不能隔离系统/Python基础环境。因此所有机器必须同构,并且Python环境基本一致。\n", + "* 里面所安装的库所依赖的其他系统文件,例如动态运行库,数据文件。如果不在virtualenv里安装的,则每个系统上均需要自行安装。" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 更进一步资料\n", + "\n", + "请参考这里:\n", + "\n", + "https://virtualenv.pypa.io/en/stable/userguide/" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "subslide" + } + }, + "source": [ + "## 软件包安装和管理建议\n", + "\n", + "Python默认情况下会试图将软件包安装到系统里,如果不具备管理员权限,需要使用virtualenv来安装软件包。\n", + "\n", + "对于Debian/Ubuntu而言,安装软件的第一选择是apt系统。如果找不到包,或版本不对,建议采用virtualenv + pip的方式安装。\n", + "\n", + "对于RHEL/CentOS而言,安装软件的第一选择是yum系统。如果找不到包,或版本不对,建议采用virtualenv + pip的方式安装。\n", + "\n", + "对于Windows/MacOS而言,建议使用virtualenv + pip的方式安装。" + ] } - ] -} \ No newline at end of file + ], + "metadata": { + "celltoolbar": "Slideshow", + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.3" + } + }, + "nbformat": 4, + "nbformat_minor": 1 +} diff --git "a/101-Python345円205円245円351円227円250円.slides.html" "b/101-Python345円205円245円351円227円250円.slides.html" index 5879837..cb4f7ee 100644 --- "a/101-Python345円205円245円351円227円250円.slides.html" +++ "b/101-Python345円205円245円351円227円250円.slides.html" @@ -9,17 +9,15 @@ + 101-Python入门 slides - - - - - + + - - - - - - - + @@ -218,70 +13317,56 @@ +
+ +
-
-
- -
-
-
-
+
+
+
-

Python入门

+

Python入门

- -
-
-
-
+
+
-

License

-

CC-BY-SA 4.0

+

License

CC-BY-SA 4.0

大部分内容来自"a byte of python",在此感谢作者。

http://python.swaroopch.com/

+
- -
-
-
-
+
+
-

python的历史

-

作者:Guido van Rossum

+

Python的历史

作者:Guido van Rossum

首次发行时间:1991

-

版本系列:2.7 / 3.5

+

版本系列:2.7 / 3.8

分类:强类型动态语言

支持系统:几乎全部

+
- -
-
-
-
+
+
-

本讲义的兼容性

-

本讲义的基础环境为python2.7/3.5。代码在这两种系统上测试通过。

-

其中有少量代码有2/3不兼容现象,在讲课时会特别提出。

-

本讲义的系统环境为Linux(Debian Stretch),有少量指令在windows下有变化,亦会特别提出。

+

本讲义的兼容性

本讲义的基础环境为Python3.8,代码保证在3.8上可运行。原则上可兼容Python2.7,Python3.3-3.7,但是并未一一测试。如发现问题可反馈。

+

其中部分代码有少量代码有2/3不兼容现象,在讲课时会特别提出。

+

本讲义的系统环境为Linux(Debian Buster),有少量指令在Windows下有变化,亦会特别提出。

+
- -
-
-
-
+
+
-

Python的成功案例

-

知名公司

+

Python的成功案例

知名公司

  • Industrial Light & Magic (工业光魔) 电影制作
  • D-Link Australia Firmware更新
  • @@ -300,29 +13385,21 @@

    Python的成功案例

  • PySpark 内存计算
  • TensorFlow 机器学习
+
-
-
-
- -
-
-
-
+
+
+
-

基础环境准备

+

基础环境准备

- -
-
-
-
+
+
-

python环境安装

-

Windows/MacOS:

+

Python环境安装

Windows/MacOS:

  1. 访问 https://www.python.org/downloads/
  2. 下载合适的版本
  3. @@ -333,64 +13410,61 @@

    python环境安装

  4. 多数系统自带
  5. 请找对应系统手册
+
- -
-
-
-
+
+
-

python运行交互界面

-

在命令行下执行python,进入python交互界面。类似这样:

-
Python 2.7.11+ (default, Apr 17 2016, 14:00:29)
-[GCC 5.3.1 20160409] on linux2
-Type "help", "copyright", "credits" or "license" for more information.
->>>
-

出现这个界面,说明你正常的安装了python。

+

Python运行交互界面

在命令行下执行python,进入Python交互界面。类似这样:

+ +
Python 3.7.3 (default, Dec 20 2019, 18:57:59) 
+[GCC 8.3.0] on linux
+Type "help", "copyright", "credits" or "license" for more information.
+>>> 
+
+
+

出现这个界面,说明你正常的安装了python。

+
- -
-
-
-
+
+
-

Jupyter演示界面

-

Jupyter是一种记事本工具。可以插入代码,进行执行,显示结果,并把这些内容保存成记事本以供后续查阅。

+

Jupyter演示界面

Jupyter是一种记事本工具。可以插入代码,进行执行,显示结果,并把这些内容保存成记事本以供后续查阅。

下面我们会大量使用Jupyter进行代码执行展示。

+
- -
-
-
-
+
+
-

简单命令测试

-

在交互界面敲入1 + 2,出现如下结果:

+

简单命令测试

在交互界面敲入1 + 2,出现如下结果:

+
>>> 1 + 2
 3
-

在交互界面敲入print(‘1+2’),出现如下结果:

-
>>> print('1+2')
-1+2
+
 
+

在交互界面敲入print(‘1+2’),出现如下结果:

+ +
>>> print('1+2')
+1+2
+
-
In [1]:
-
1 + 2
+
1 + 2
 
-
+
@@ -398,13 +13472,15 @@

简单命令测试

-
Out[1]:
+
+
Out[1]:
-
-
-3
-
+ + + +
+
3
@@ -418,10 +13494,10 @@

简单命令测试

In [2]:
-
print('1+2')
+
print('1+2')
 
-
+
@@ -429,11 +13505,13 @@

简单命令测试

-
-
-
-1+2
+
+ + + +
+
1+2
 
@@ -442,27 +13520,22 @@

简单命令测试

- -
-
-
-
+
+
-

文件编辑和执行

-

用任意编辑器(随你喜欢)新建一文件,修改内容为print('1+2'),然后将其保存为xxx.py文件。

+

文件编辑和执行

用任意编辑器(随你喜欢)新建一文件,修改内容为print('1+2'),然后将其保存为xxx.py文件。

然后用python执行文件:python xxx.py

注意,如果python不在默认路径中(常见于windows),需要写完整路径。

+
- -
-
-
-
+
+

以下代码,%%开头的为jupyter内部指令。writefile为写入文件。

!开头的为系统指令。cat和rm为linux系统指令,windows下需要做变更。

+
@@ -471,11 +13544,11 @@

文件编辑和执行

In [3]:
-
%%writefile test.py
-print('1+2')
+
%%writefile test.py
+print('1+2')
 
-
+
@@ -483,11 +13556,13 @@

文件编辑和执行

-
-
-
-Writing test.py
+
+ + + +
+
Writing test.py
 
@@ -501,10 +13576,10 @@

文件编辑和执行

In [4]:
-
!cat test.py
+
!cat test.py
 
-
+
@@ -512,11 +13587,13 @@

文件编辑和执行

-
+
+ + + +
-
-print('1+2')
-
+
print('1+2')
@@ -529,10 +13606,10 @@

文件编辑和执行

In [5]:
-
!python test.py
+
!python test.py
 
-
+
@@ -540,71 +13617,47 @@

文件编辑和执行

-
-
-
-1+2
-
-
-
-
+
-
-
+ -
- -
-
-
In [6]:
-
-
-
!rm test.py
-
-
+
+
1+2
+
-
-
-
- -
- -
+ +
+
+
-

Python基本语法

+

Python基本语法

- -
-
-
-
+
+
-

基本类型

-
    +

    基本类型

    • 注释:以#开头的为注释,直到行结束为止。
    • -
    • 数字:以数字,.或者-开头的为数字。带小数点.的为浮点数,不带小数点的为整数。支持科学计数法,例如52.3E-4。
    • +
    • 数字:以数字,.或者-开头的为数字。带小数点.的为浮点数,不带小数点的为整数。支持科学计数法,例如52.3E-4。可以以_作为分隔,增强可读性,例如1_000_000。
    • 字符串:以单引号’,双引号",三引号’’’开始,同样符号结束。
    • 布尔值:只有两个,True和False。大小写敏感。
    • 空值:只有一个,None。大小写敏感。表示没有值的值。

    练习:写出数字和字符串的例子,并加以注释。

    +
- -
-
-
-
+
+
-

例子

+

例子

@@ -613,10 +13666,10 @@

例子

In [7]:
-
52.3E-4
+
52.3E-4
 
-
+
@@ -624,13 +13677,15 @@

例子

-
Out[7]:
+
+
Out[7]:
-
-
-0.00523
-
+ + + +
+
0.00523
@@ -644,10 +13699,10 @@

例子

In [8]:
-
'string'
+
'string'
 
-
+
@@ -655,13 +13710,15 @@

例子

-
Out[8]:
+
+
Out[8]:
-
-
-'string'
-
+ + + +
+
'string'
@@ -675,10 +13732,10 @@

例子

In [9]:
-
"string"
+
"string"
 
-
+
@@ -686,13 +13743,15 @@

例子

-
Out[9]:
+
+
Out[9]:
-
-
-'string'
-
+ + + +
+
'string'
@@ -706,10 +13765,10 @@

例子

In [10]:
-
'''string'''
+
'''string'''
 
-
+
@@ -717,13 +13776,15 @@

例子

-
Out[10]:
+
+
Out[10]:
-
-
-'string'
-
+ + + +
+
'string'
@@ -732,16 +13793,15 @@

例子

-
In [11]:
-
True
+
True
 
-
+
@@ -749,13 +13809,15 @@

例子

-
Out[11]:
+
+
Out[11]:
-
-
-True
-
+ + + +
+
True
@@ -769,10 +13831,10 @@

例子

In [12]:
-
False
+
False
 
-
+
@@ -780,13 +13842,15 @@

例子

-
Out[12]:
+
+
Out[12]:
-
-
-False
-
+ + + +
+
False
@@ -800,10 +13864,10 @@

例子

In [13]:
-
1 == 0
+
1 == 0
 
-
+
@@ -811,13 +13875,15 @@

例子

-
Out[13]:
+
+
Out[13]:
-
-
-False
-
+ + + +
+
False
@@ -831,10 +13897,10 @@

例子

In [14]:
-
1 == 1
+
1 == 1
 
-
+
@@ -842,13 +13908,15 @@

例子

-
Out[14]:
+
+
Out[14]:
-
-
-True
-
+ + + +
+
True
@@ -862,25 +13930,22 @@

例子

In [15]:
-
None
+
None
 
-
+
- -
-
-
-
+
+
-

字符串转义

-

在单引号字符串中表达单引号需要转义,双引号和三引号同。例如:

+

字符串转义

在单引号字符串中表达单引号需要转义,双引号和三引号同。例如:

"what’s wrong"是合法字符串。’what’s wrong’会出错,需要写为’what\’s wrong’。

转义也可以用于表达不可见字符,例如tab:\t。

-

如果要表达\本身,也需要转义,写为\。

+

如果要表达\本身,也需要转义,写为\\。

+
@@ -889,10 +13954,10 @@

字符串转义

In [16]:
-
'what\'s wrong'
+
'what\'s wrong'
 
-
+
@@ -900,13 +13965,15 @@

字符串转义

-
Out[16]:
+
+
Out[16]:
-
-
-"what's wrong"
-
+ + + +
+
"what's wrong"
@@ -915,15 +13982,12 @@

字符串转义

- -
-
-
-
+
+
-

Raw String

-

在字符串的开始加r,使得字符串中不发生转义。

+

Raw String

在字符串的开始加r,使得字符串中不发生转义。

常用于大量需要表达\的字符串。

+
@@ -932,10 +13996,10 @@

Raw String

In [17]:
-
r'what\'s wrong'
+
r'what\'s wrong'
 
-
+
@@ -943,13 +14007,15 @@

Raw String

-
Out[17]:
+
+
Out[17]:
-
-
-"what\\'s wrong"
-
+ + + +
+
"what\\'s wrong"
@@ -963,10 +14029,10 @@

Raw String

In [18]:
-
print(r'what\'s wrong')
+
print(r'what\'s wrong')
 
-
+
@@ -974,11 +14040,13 @@

Raw String

-
-
-
-what\'s wrong
+
+ + + +
+
what\'s wrong
 
@@ -987,31 +14055,26 @@

Raw String

- -
-
-
-
+
+
-

Unicode字符串

-

在字符串前加u,表示这是一个unicode字符串。

-

unicode字符串和普通字符串的区别在于。unicode字符串中,每一个位表示一个"字"。

-

而普通字符串中,一个"字"可能由多个位表示。尤其是中文的情况下。

+

Unicode字符串

在字符串前加u,表示这是一个unicode字符串。前面加b,表示是一个bytes字符串(也叫raw字符串)。如果什么都不加,则看Python版本。Python2中默认为raw字符串,Python3中默认为unicode字符串。

+

unicode字符串和普通字符串的区别在于。unicode字符串中,每一个位表示一个"字"。而普通字符串中,一个位表示一个字节。

+

一个"字"可能由一个字节表示,也可能由多个字节表示。尤其是中文的情况下。这种"字符串"在处理文字的时候容易发生混乱。

unicode字符串和普通字符串外形相似,但是很多地方无法混用。

-

更进一步信息在"字符编码简说"这章有详细解释。

+
-
In [19]:
-
u'string'
+
u'string'
 
-
+
@@ -1019,13 +14082,15 @@

Unicode字符串

-
Out[19]:
+
+
Out[19]:
-
-
-u'string'
-
+ + + +
+
'string'
@@ -1039,10 +14104,10 @@

Unicode字符串

In [20]:
-
'string' == u'string'
+
'string' == u'string'
 
-
+
@@ -1050,13 +14115,15 @@

Unicode字符串

-
Out[20]:
+
+
Out[20]:
-
-
-True
-
+ + + +
+
True
@@ -1070,12 +14137,12 @@

Unicode字符串

In [21]:
-
# -*- coding: utf-8 -*-
-'中文' == u'中文'
+
# -*- coding: utf-8 -*-
+'中文' == u'中文'
 # 在Python2下不相等,Python3下相等。因为Python3下都是Unicode。
 
-
+
@@ -1083,22 +14150,15 @@

Unicode字符串

-
-
-
--c:2: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
+
-
-
-
+
Out[21]:
-
Out[21]:
-
-
-False
-
+ +
+
True
@@ -1107,83 +14167,67 @@

Unicode字符串

- -
-
-
-
+
+
-

变量

-

变量需要一个名字。

+

变量

变量需要一个名字。

首字母需要是字母或下划线,其余部分可以是字母,下划线和数字。

变量大小写敏感,但是使用大小写区分变量是不可取的。

+
- -
-
-
-
+
+
-

变量类型

-

每个变量都会指向一个值,每个值都拥有一个类型。

+

变量类型

每个变量都会指向一个值,每个值都拥有一个类型。

变量在运行过程中可以指向不同的值,拥有不同的类型。

因此在运行前无法知道名字所对应的类型。(动态类型语言特征)

+
-
-
-
- -
-
-
-
+
+
+
-

算符和表达式

+

算符和表达式

- -
-
-
-
+
+
-

算符

-

算符是连接一个或多个元素的符号,用来表达计算。

+

算符

算符是连接一个或多个元素的符号,用来表达计算。

常见算符:

+
+ - * ** / // % << >> & | ^ ~ < > <= >= == != not and or
-

算符和赋值的快速写法

+ + +

算符和赋值的快速写法

+
a = 10
 a = a + 10
-a += 10
-
+a += 10 +
- -
-
-
-
+
+
+
-

算符优先级

-
    +

    算符优先级

    • lambda
    • if - else
    • or
    • @@ -1202,53 +14246,46 @@

      算符优先级

    • (expressions...), [expressions...], {key: value...}, {expressions...}

    使用()可以改变优先级顺序

    +
- -
-
-
-
+
+
+
-

练习

-

计算以下表达式的求值顺序,并求值算出结果:

+

练习

计算以下表达式的求值顺序,并求值算出结果:

+
1 + 8 <= 1 + 2 * 3
-1 + 2 and 3 * 4 or 5 ** 6
-
-
+1 + 2 and 3 * 4 or 5 ** 6 +
-
- -
-
-
-
+
+
+
-

答案

+

答案

@@ -1257,10 +14294,10 @@

答案

In [22]:
-
1 + 8 <= 1 + 2 * 3
+
1 + 8 <= 1 + 2 * 3
 
-
+
@@ -1268,13 +14305,15 @@

答案

-
Out[22]:
+
+
Out[22]:
-
-
-False
-
+ + + +
+
False
@@ -1288,10 +14327,10 @@

答案

In [23]:
-
1 + 2 and 3 * 4 or 5 ** 6
+
1 + 2 and 3 * 4 or 5 ** 6
 
-
+
@@ -1299,13 +14338,15 @@

答案

-
Out[23]:
+
+
Out[23]:
-
-
-12
-
+ + + +
+
12
@@ -1314,33 +14355,29 @@

答案

- -
-
-
-
+
+
-

表达式

-

表达式为一串由算符连接的元素。

+

表达式

表达式为一串由算符连接的元素。

表达式一般会有值,值为按照优先级依次求解表达式得到的结果。

有些表达式在语法上亦不可求值。

表达式除了值以外,还可能造成"副作用"。即造成环境改变,或执行某些操作。

+
-
In [24]:
-
Pi = 3.14
+
Pi = 3.14
 r = 5
 area = Pi * r * r
-print("area is {0}".format(area))
+print("area is {0}".format(area))
 
-
+
@@ -1348,11 +14385,13 @@

表达式

-
-
-
-area is 78.5
+
+ + + +
+
area is 78.5
 
@@ -1361,31 +14400,27 @@

表达式

- -
-
-
-
+
+
-

格式化字符串

-

将变量的值格式化到字符串中,形成新的字符串。

+

格式化字符串

将变量的值格式化到字符串中,形成新的字符串。

常用于输出数据内容。

+
-
In [25]:
-
name = 'shell'
+
name = 'shell'
 
-print('my name is {0} and the length of name is {1}'.format(name, len(name)))
-print('my name is %s and the length of name is %d' % (name, len(name)))
+print('my name is {0} and the length of name is {1}'.format(name, len(name)))
+print('my name is %s and the length of name is %d' % (name, len(name)))
 
-
+
@@ -1393,12 +14428,14 @@

格式化字符串

-
+
+ + + +
-
+
my name is shell and the length of name is 5
 my name is shell and the length of name is 5
-my name is shell and the length of name is 5
-
 
@@ -1407,54 +14444,84 @@

格式化字符串

- -
-
+
+
+
+

f-string

借助f-string,我们可以在字符串内直接引用变量,格式化字符串。

+ +
+
+
+
+
In [26]:
+
+
name = 'shell'
+
+print(f'my name is {name} and the length of name is {len(name)}')
+
+ +
+
+
+ +
+
+ + +
+ + + + +
+
my name is shell and the length of name is 5
+
+
+
+ +
+
+ +
+
+
-

练习

-
    +

    练习

    • 编写一行代码,打印出hello, world。
    • 假定有变量name,值为你的名字。编写代码打印出hello, [your name]。
    +
-
-
-
- -
-
-
-
+
+
+
-

执行流控制

-

执行流控制代码控制流的先后执行顺序。

+

执行流控制

执行流控制代码控制流的先后执行顺序。

+
- -
-
-
-
+
+
-

逻辑行和物理行

-

Python语句执行以行为单位。每行可选的可以以分号;结尾。

+

逻辑行和物理行

Python语句执行以行为单位。每行可选的可以以分号;结尾。

但是物理上的一行可以包含多个执行单位,例如:

+
-
In [26]:
+
In [27]:
-
i = 5; print(i);
+
i = 5; print(i);
 
-
+
@@ -1462,11 +14529,13 @@

逻辑行和物理行

-
-
-
-5
+
+ + + +
+
5
 
@@ -1475,25 +14544,24 @@

逻辑行和物理行

-
-
-
-
+
+

同一个执行单位也可以拆分为多行,例如:

+
-
In [27]:
+
In [28]:
-
print(
+
print(
 'Hello, world')
 
-
+
@@ -1501,11 +14569,13 @@

逻辑行和物理行

-
-
-
-Hello, world
+
+ + + +
+
Hello, world
 
@@ -1514,29 +14584,26 @@

逻辑行和物理行

- -
-
-
-
+
+
-

格式对齐

-

Python使用对齐表达逻辑,例如:

+

格式对齐

Python使用对齐表达逻辑,例如:

+
-
In [28]:
+
In [29]:
-
a = 1
+
a = 1
 if a == 1:
- print('ok')
-print('done')
+ print('ok')
+print('done')
 
-
+
@@ -1544,12 +14611,14 @@

格式对齐

-
+
+ + + +
-
-ok
+
ok
 done
-
 
@@ -1558,36 +14627,34 @@

格式对齐

-
-
-
-
+
+

当print(‘done’)和if对齐时,必然被执行。而和print(‘ok’)对齐时,在条件下执行。

因此对齐不合适的代码会引发语法错误。

+
-
-
In [29]:
+
In [30]:
-
a = 0
+
a = 0
 if a == 1:
- print('ok')
-print('done')
+ print('ok')
+print('done')
 
-print('------')
+print('------')
 
 a = 1
 if a == 1:
- print('ok')
-print('done')
+ print('ok')
+print('done')
 
-
+
@@ -1595,14 +14662,16 @@

格式对齐

-
+
+ + + +
-
-done
+
done
 ------
 ok
 done
-
 
@@ -1611,26 +14680,25 @@

格式对齐

-
-
In [30]:
+
In [31]:
-
a = 0
+
a = 0
 if a == 1:
- print('ok')
- print('done')
+ print('ok')
+ print('done')
 
-print('------')
+print('------')
 
 a = 1
 if a == 1:
- print('ok')
- print('done')
+ print('ok')
+ print('done')
 
-
+
@@ -1638,13 +14706,15 @@

格式对齐

-
+
+ + + +
-
-------
+
------
 ok
 done
-
 
@@ -1653,25 +14723,22 @@

格式对齐

- -
-
-
-
+
+
-

单行写法

+

单行写法

-
In [31]:
+
In [32]:
-
if True: print('ok')
+
if True: print('ok')
 
-
+
@@ -1679,11 +14746,13 @@

单行写法

-
-
-
-ok
+
+ + + +
+
ok
 
@@ -1692,41 +14761,42 @@

单行写法

- -
-
-
-
+
+
-

if

+

if

-
In [32]:
+
In [33]:
-
# input是python3写法,raw_input是对应的python2写法。
+
import random
+# input是python3写法,raw_input是对应的python2写法。
+# 此处四行是Python2/3兼容写法,后续统一写为input,不再出现这四行。
 try:
- input = raw_input
+ input = raw_input
 except NameError:
 pass
 
-number = 23
+number = random.randint(10, 30)
+print('number:', number)
 
-guess = int(input('Enter an integer : '))
+guess = random.randint(10, 30)
+print("guess:", guess)
 if guess == number:
- print('Congratulations, you guessed it.')
- print('(but you do not win any prizes!)')
+ print('Congratulations, you guessed it.')
+ print('(but you do not win any prizes!)')
 elif guess < number:
- print('No, it is a little higher than that')
+ print('No, it is a little higher than that')
 else:
- print('No, it is a little lower than that')
-print('Done')
+ print('No, it is a little lower than that')
+print('Done')
 
-
+
@@ -1734,13 +14804,16 @@

if

-
+
+ + + +
-
-Enter an integer : 10
-No, it is a little higher than that
+
number: 12
+guess: 23
+No, it is a little lower than that
 Done
-
 
@@ -1749,43 +14822,45 @@

if

- -
-
-
-
+
+
-

while

+

while

-
In [33]:
+
In [34]:
-
try:
- input = raw_input
-except NameError:
- pass
+
import random
+
+number = random.randint(0, 99)
+print('number:', number)
+
+low = 0
+high = 100
+running = True
 
-number = 23
-running = True
 while running:
- guess = int(input('Enter an integer : '))
+ guess = int((low+high)/2)
+ print('guess:', guess)
 if guess == number:
- print('Congratulations, you guessed it.')
- running = False
+ print('Congratulations, you guessed it.')
+ running = False
 elif guess < number:
- print('No, it is a little higher than that.')
+ print('No, it is a little higher than that.')
+ low = guess
 else:
- print('No, it is a little lower than that.')
+ print('No, it is a little lower than that.')
+ high = guess
 else:
- print('The while loop is over.')
-print('Done')
+ print('The while loop is over.')
+print('Done')
 
-
+
@@ -1793,18 +14868,29 @@

while

-
+
+ + + +
-
-Enter an integer : 10
+
number: 61
+guess: 50
 No, it is a little higher than that.
-Enter an integer : 30
+guess: 75
+No, it is a little lower than that.
+guess: 62
 No, it is a little lower than that.
-Enter an integer : 23
+guess: 56
+No, it is a little higher than that.
+guess: 59
+No, it is a little higher than that.
+guess: 60
+No, it is a little higher than that.
+guess: 61
 Congratulations, you guessed it.
 The while loop is over.
 Done
-
 
@@ -1813,28 +14899,25 @@

while

- -
-
-
-
+
+
-

for

+

for

-
In [34]:
+
In [35]:
-
for i in range(1, 5):
- print(i)
+
for i in range(1, 5):
+ print(i)
 else:
- print('The for loop is over')
+ print('The for loop is over')
 
-
+
@@ -1842,15 +14925,17 @@

for

-
+
+ + + +
-
-1
+
1
 2
 3
 4
 The for loop is over
-
 
@@ -1859,35 +14944,45 @@

for

- -
-
-
-
+
+
-

break

+

break

-
In [35]:
+
In [36]:
-
try:
- input = raw_input
-except NameError:
- pass
+
import random
+
+number = random.randint(0, 99)
+print('number:', number)
 
-while True:
- s = input('Enter something : ')
- if s == 'quit':
+low = 0
+high = 100
+running = True
+
+while running:
+ guess = int((low+high)/2)
+ print('guess:', guess)
+ if guess == number:
+ print('Congratulations, you guessed it.')
 break
- print('Length of the string is %d' % len(s))
-print('Done')
+ elif guess < number:
+ print('No, it is a little higher than that.')
+ low = guess
+ else:
+ print('No, it is a little lower than that.')
+ high = guess
+else:
+ print('The while loop is over.')
+print('Done')
 
-
+
@@ -1895,14 +14990,24 @@

break

-
+
+ + + +
-
-Enter something : 1
-Length of the string is 1
-Enter something : quit
+
number: 90
+guess: 50
+No, it is a little higher than that.
+guess: 75
+No, it is a little higher than that.
+guess: 87
+No, it is a little higher than that.
+guess: 93
+No, it is a little lower than that.
+guess: 90
+Congratulations, you guessed it.
 Done
-
 
@@ -1911,37 +15016,47 @@

break

- -
-
-
-
+
+
-

continue

+

continue

-
In [36]:
+
In [37]:
-
try:
- input = raw_input
-except NameError:
- pass
+
import random
 
-while True:
- s = input('Enter something : ')
- if s == 'quit':
+number = random.randint(0, 99)
+print('number:', number)
+
+low = 0
+high = 100
+running = True
+
+while running:
+ guess = int((low+high)/2)
+ print('guess:', guess)
+ if guess == number:
+ print('Congratulations, you guessed it.')
 break
- if len(s) < 3:
- print('Too small')
+ if guess < number:
+ print('No, it is a little higher than that.')
+ low = guess
 continue
- print('Input is of sufficient length')
+ if guess > number:
+ print('No, it is a little lower than that.')
+ high = guess
+ continue
+else:
+ print('The while loop is over.')
+print('Done')
 
-
+
@@ -1949,15 +15064,24 @@

continue

-
-
-
-Enter something : 1
-Too small
-Enter something : 123
-Input is of sufficient length
-Enter something : quit
+
+ + + +
+
number: 84
+guess: 50
+No, it is a little higher than that.
+guess: 75
+No, it is a little higher than that.
+guess: 87
+No, it is a little lower than that.
+guess: 81
+No, it is a little higher than that.
+guess: 84
+Congratulations, you guessed it.
+Done
 
@@ -1966,50 +15090,44 @@

continue

- -
-
-
-
+
+
-

练习

-

说出下面代码的执行过程和输出结果:

+

练习

说出下面代码的执行过程和输出结果:

+
for i in range(12):
 if i < 5:
 continue
 elif i > 9:
 break
 else:
- print(i)
-
+ print(i) +
- -
-
-
-
+
+
-

答案

+

答案

-
In [37]:
+
In [38]:
-
for i in range(12):
+
for i in range(12):
 if i < 5:
 continue
 elif i > 9:
 break
 else:
- print(i)
+ print(i)
 
-
+
@@ -2017,15 +15135,17 @@

答案

-
+
+ + + +
-
-5
+
5
 6
 7
 8
 9
-
 
@@ -2033,62 +15153,53 @@

答案

-
-
-
- -
-
-
-
+
+
+
-

函数

+

函数

- -
-
-
-
+
+
-

函数的定义和调用

-

定义:

+

函数的定义和调用

定义:

+
-
In [38]:
+
In [39]:
-
def say_hello():
- print('hello world')
+
def say_hello():
+ print('hello world')
 
-
+
-
-
-
-
+
+

调用:

+
-
In [39]:
+
In [40]:
-
say_hello()
+
say_hello()
 
-
+
@@ -2096,11 +15207,13 @@

函数的定义和调用

-
-
-
-hello world
+
+ + + +
+
hello world
 
@@ -2109,33 +15222,30 @@

函数的定义和调用

- -
-
-
-
+
+
-

参数

-

可以通过参数向函数传递数据。

+

参数

可以通过参数向函数传递数据。

+
-
In [40]:
+
In [41]:
-
def print_max(a, b):
+
def print_max(a, b):
 if a > b:
- print('{0} is maximum'.format(a))
+ print('{0} is maximum'.format(a))
 elif a == b:
- print('{0} is equal to {1}'.format(a, b))
+ print('{0} is equal to {1}'.format(a, b))
 else:
- print('{0} is maximum'.format(b))
+ print('{0} is maximum'.format(b))
 print_max(3, 4)
 
-
+
@@ -2143,11 +15253,13 @@

参数

-
-
-
-4 is maximum
+
+ + + +
+
4 is maximum
 
@@ -2158,15 +15270,18 @@

参数

-
In [41]:
+
In [42]:
-
# python2.7下通过,python3下报错
-print_max(3, '4')
-print_max('3', 4)
+
# python2.7下通过,python3下报错
+try:
+ print_max(3, '4')
+ print_max('3', 4)
+except:
+ print('exceptions')
 
-
+
@@ -2174,12 +15289,13 @@

参数

-
-
-
-4 is maximum
-3 is maximum
+
+ + + +
+
exceptions
 
@@ -2188,47 +15304,42 @@

参数

- -
-
-
-
+
+
+
-

局部变量

-

在函数体内定义的变量称为局部变量。

+

局部变量

在函数体内定义的变量称为局部变量。

局部变量在函数执行时产生,在函数结束时消亡。函数外无法看到局部变量。

参数可视为一种局部变量。

对局部变量的修改不影响全局变量。

+
-
-
In [42]:
+
In [43]:
-
x = 50
+
x = 50
 def func():
 x = 2
- print('Changed local x to {0}'.format(x))
+ print('Changed local x to {0}'.format(x))
 func()
-print(x)
+print(x)
 
-
+
@@ -2236,12 +15347,14 @@

局部变量

-
+
+ + + +
-
-Changed local x to 2
+
Changed local x to 2
 50
-
 
@@ -2252,17 +15365,17 @@

局部变量

-
In [43]:
+
In [44]:
-
x = 50
+
x = 50
 def func(x):
- print('Changed local x to {0}'.format(x))
+ print('Changed local x to {0}'.format(x))
 func(2)
-print(x)
+print(x)
 
-
+
@@ -2270,12 +15383,14 @@

局部变量

-
+
+ + + +
-
-Changed local x to 2
+
Changed local x to 2
 50
-
 
@@ -2284,32 +15399,28 @@

局部变量

- -
-
-
-
+
+
-

全局变量

-

在模块内定义的变量叫全局变量。

+

全局变量

在模块内定义的变量叫全局变量。

全局变量在全局可见,函数体内可以引用全局变量。

函数可以用global关键字声明某变量是全局的。

+
-
-
In [44]:
+
In [45]:
-
x = 50
+
x = 50
 def func():
- print('x is {0}'.format(x))
+ print('x is {0}'.format(x))
 func()
 
-
+
@@ -2317,11 +15428,13 @@

全局变量

-
-
-
-x is 50
+
+ + + +
+
x is 50
 
@@ -2332,22 +15445,22 @@

全局变量

-
In [45]:
+
In [46]:
-
x = 50
+
x = 50
 def func():
 global x
- print('x is {0}'.format(x))
+ print('x is {0}'.format(x))
 x = 2
- print('Changed x to {0}'.format(x))
+ print('Changed x to {0}'.format(x))
 
-print('x is {0} before function.'.format(x))
+print('x is {0} before function.'.format(x))
 func()
-print('x is {0} after function.'.format(x))
+print('x is {0} after function.'.format(x))
 
-
+
@@ -2355,14 +15468,16 @@

全局变量

-
+
+ + + +
-
-x is 50 before function.
+
x is 50 before function.
 x is 50
 Changed x to 2
 x is 2 after function.
-
 
@@ -2371,49 +15486,42 @@

全局变量

- -
-
-
-
+
+
-

作用域

-

变量可见的范围叫做变量的作用域。

+

作用域

变量可见的范围叫做变量的作用域。

局部变量的作用域在函数内,全局变量的作用域在模块内(关于模块后文会讲)。

作用域的基本原则是,内层作用域可访问外层作用域的变量,反之外层不可访问内层变量。

如果两个作用域内有同一个名字,那么内层的起作用。

+
- -
-
-
-
+
+
-

Unbound异常

-

python内的"local中有变量定义",是以local中存在对变量构建的语法(例如赋值)为标准的。

+

Unbound异常

python内的"local中有变量定义",是以local中存在对变量构建的语法(例如赋值)为标准的。

这个构建语法所在行可能尚未执行(或永远无法执行到),但是这并不影响"local中有变量定义"这个事实。

当local中定义了变量,但是变量尚未完成构建时,对变量做引用,会发生什么?

+
-
-
In [46]:
+
In [47]:
-
x = 1
+
x = 1
 
 def func():
- print(x)
+ print(x)
 x = 2
 
 func()
 
-
+
@@ -2421,24 +15529,28 @@

Unbound异常

-
-
+
+ + + + +
----------------------------------------------------------------------------
-UnboundLocalError Traceback (most recent call last)
-<ipython-input-46-a910e175aa0b> in <module>()
- 5 x = 2
- 6 
-----> 7func()
+---------------------------------------------------------------------------
+UnboundLocalError Traceback (most recent call last)
+<ipython-input-47-d73f257fa89f> in <module>()
+ 5 x = 2
+ 6 
+----> 7func()
 
-<ipython-input-46-a910e175aa0b> in func()
- 2 
- 3 def func():
-----> 4print(x)
- 5 x = 2
- 6 
+<ipython-input-47-d73f257fa89f> in func()
+ 2 
+ 3 def func():
+----> 4print(x)
+ 5 x = 2
+ 6 
 
-UnboundLocalError: local variable 'x' referenced before assignment
+UnboundLocalError: local variable 'x' referenced before assignment
@@ -2446,31 +15558,28 @@

Unbound异常

- -
-
-
-
+
+
-

参数默认值

-

函数定义时,可以给参数一个值。当调用时,该参数并未给出的情况下,使用默认值。

+

参数默认值

函数定义时,可以给参数一个值。当调用时,该参数并未给出的情况下,使用默认值。

提示:从安全性角度来说,不要使用可变对象作为参数默认值。

+
-
In [47]:
+
In [48]:
-
def say(message, times=1):
- print(message * times)
+
def say(message, times=1):
+ print(message * times)
 
 say('Hello')
 say('World', 5)
 
-
+
@@ -2478,12 +15587,14 @@

参数默认值

-
+
+ + + +
-
-Hello
+
Hello
 WorldWorldWorldWorldWorld
-
 
@@ -2492,26 +15603,25 @@

参数默认值

-
-
In [48]:
+
In [49]:
-
def append1(l=[]):
+
def append1(l=[]):
 l.append(1)
 return l
 
-print(append1([]))
-print(append1([]))
+print(append1([]))
+print(append1([]))
 
-print('------')
+print('------')
 
-print(append1())
-print(append1())
+print(append1())
+print(append1())
 
-
+
@@ -2519,15 +15629,17 @@

参数默认值

-
+
+ + + +
-
-[1]
+
[1]
 [1]
 ------
 [1]
 [1, 1]
-
 
@@ -2536,40 +15648,37 @@

参数默认值

- -
-
-
-
+
+

遇到希望使用可变对象作为参数默认值的情况,需要使用None作为默认值。

在函数中判断是否为None,是的话再对参数做默认值赋值处理。

以此模式来避免上述问题。

+
-
-
In [49]:
+
In [50]:
-
def append1(l=None):
- if l is None:
+
def append1(l=None):
+ if l is None:
 l = []
 l.append(1)
 return l
 
-print(append1([]))
-print(append1([]))
+print(append1([]))
+print(append1([]))
 
-print('------')
+print('------')
 
-print(append1())
-print(append1())
+print(append1())
+print(append1())
 
-
+
@@ -2577,15 +15686,17 @@

参数默认值

-
+
+ + + +
-
-[1]
+
[1]
 [1]
 ------
 [1]
 [1]
-
 
@@ -2594,23 +15705,20 @@

参数默认值

- -
-
-
-
+
+
-

返回值

-

将函数内数据传递回去。

+

返回值

将函数内数据传递回去。

+
-
In [50]:
+
In [51]:
-
def maximum(x, y):
+
def maximum(x, y):
 if x > y:
 return x
 elif x == y:
@@ -2618,11 +15726,11 @@ 

返回值

else: return y -print(maximum(2, 3)) -print(maximum(2, 2)) +print(maximum(2, 3)) +print(maximum(2, 2))
-
+
@@ -2630,12 +15738,14 @@

返回值

-
+
+ + + +
-
-3
+
3
 The numbers are equal
-
 
@@ -2644,43 +15754,39 @@

返回值

- -
-
-
-
+
+
-

多值返回

-

Python允许一次返回多个值。

+

多值返回

Python允许一次返回多个值。

多值返回的本质是使用tuple中转(后面详细讲解)。

+
+
-
In [51]:
+
In [52]:
-
def f():
+
def f():
 return 1,2,3,4,5
-print (f())
+print (f())
 
 a,b,c,d,e = f()
-print(c)
+print(c)
 
-
+
@@ -2688,12 +15794,14 @@

多值返回

-
+
+ + + +
-
-(1, 2, 3, 4, 5)
+
(1, 2, 3, 4, 5)
 3
-
 
@@ -2702,50 +15810,135 @@

多值返回

- -
-
-
-
+
+
-

Doc String

-

Python允许为每个函数增加一个文档字符串,这个文档字符串可以被代码访问。

+

Doc String

Python允许为每个函数增加一个文档字符串,这个文档字符串可以被代码访问。

具体方式是,在函数的第一个逻辑行定义一个字符串(不执行任何操作)。

访问方式是function.__doc__。

+ +
+
+
+
+
+
In [53]:
+
+
+
def print_max(x, y):
+ '''Prints the maximum of two numbers. \nThe two values must be integers.'''
+ x = int(x)
+ y = int(y)
+ if x > y:
+ print('{} is maximum'.format(x))
+ else:
+ print('{} is maximum'.format(y))
+
+print_max(3, 5)
+print(print_max.__doc__)
+
+ +
+
+
+ +
+
+ + +
+ + + + +
+
5 is maximum
+Prints the maximum of two numbers. 
+The two values must be integers.
+
+
+
+ +
+
+ +
+
+
+
+

Annotations

Python允许对函数的变量进行注解,表明参数和返回值的类型。

+ +
+
+
+
+
+
In [54]:
+
+
+
def maximum(x: int, y: int) -> int:
+ if x > y:
+ return x
+ elif x == y:
+ return 'The numbers are equal'
+ else:
+ return y
+
+maximum(1, 2)
+
+ +
+
+
+ +
+
+ + +
+ +
Out[54]:
+ + + + +
+
2
+
+
+
-
+
+
-

讲解doc string在文档里的作用,对比java doc。

+

然而,Python默认对注解不做验证。

+
-
-
-
In [52]:
+
In [55]:
-
def print_max(x, y):
- '''Prints the maximum of two numbers. \nThe two values must be integers.'''
- x = int(x)
- y = int(y)
- if x > y:
- print('{} is maximum'.format(x))
- else:
- print('{} is maximum'.format(y))
-
-print_max(3, 5)
-print(print_max.__doc__)
+
maximum('1', '2')
 
-
+
@@ -2753,46 +15946,45 @@

Doc String

-
-
-
-5 is maximum
-Prints the maximum of two numbers. 
-The two values must be integers.
+
-
+
Out[55]:
+ + + + +
+
'2'
+
- -
-
-
-
+
+
-

lambda

-

一种快速定义简单函数的方法。

+

lambda

一种快速定义简单函数的方法。

+
-
In [53]:
+
In [56]:
-
def inc(n):
+
def inc(n):
 return n+1
-print(inc(10))
+print(inc(10))
 
 inc = lambda n: n+1
-print(inc(10))
+print(inc(10))
 
-
+
@@ -2800,12 +15992,14 @@

lambda

-
+
+ + + +
-
+
11
 11
-11
-
 
@@ -2814,54 +16008,47 @@

lambda

- -
-
-
-
+
+
-

练习

-

定义fib函数。

+

练习

定义fib函数。

输入n,fib的输出为数列第n项的值。

数列某项等于前两项之和。

+
- -
-
-
-
+
+
+
-

答案

+

答案

-
In [54]:
+
In [57]:
-
def fib(n):
+
def fib(n):
 if n <= 1: return 1
 return fib(n-1) + fib(n-2)
 
 fib(10)
 
-
+
@@ -2869,13 +16056,15 @@

答案

-
Out[54]:
+
+
Out[57]:
-
-
-89
-
+ + + +
+
89
@@ -2883,50 +16072,41 @@

答案

-
-
-
- -
-
-
-
+
+
+
-

模块

+

模块

- -
-
-
-
+
+
-

Module

-

预先写好的代码,供其他代码使用。

+

Module

预先写好的代码,供其他代码使用。

一个module是一个独立文件。

每个module拥有自己的全局变量空间。数据定义,函数,均定义在其中。

+
-
-
In [55]:
+
In [58]:
-
%%writefile testmod.py
-varible1 = 1
-varible2 = 2
+
%%writefile testmod.py
+varible1 = 1
+varible2 = 2
 
-def add(a, b):
- return a+b
+def add(a, b):
+ return a+b
 
-if __name__ == '__main__':
- print('run as script')
+if __name__ == '__main__':
+ print('run as script')
 
-
+
@@ -2934,11 +16114,13 @@

Module

-
-
-
-Writing testmod.py
+
+ + + +
+
Writing testmod.py
 
@@ -2949,13 +16131,13 @@

Module

-
In [56]:
+
In [59]:
-
!ls -l testmod.py
+
!ls -l testmod.py
 
-
+
@@ -2963,11 +16145,13 @@

Module

-
-
-
--rw-r--r-- 1 shell shell 111 10月 28 20:06 testmod.py
+
+ + + +
+
-rw-r--r-- 1 shell shell 111 Mar 22 20:06 testmod.py
 
@@ -2976,36 +16160,32 @@

Module

-
-
-
-
+
+

Windows下要用dir testmod.py

+
- -
-
-
-
+
+
-

import

-

import引入某个module对象,可使用module.name的方式引用它的全局变量。

+

import

import引入某个module对象,可使用module.name的方式引用它的全局变量。

+
-
In [57]:
+
In [60]:
-
import testmod
+
import testmod
 testmod.varible1
 
-
+
@@ -3013,13 +16193,15 @@

import

-
Out[57]:
+
+
Out[60]:
-
-
-1
-
+ + + +
+
1
@@ -3028,29 +16210,26 @@

import

- -
-
-
-
+
+
-

from import

-

from import引入模块中的某个(或全部)变量。

+

from import

from import引入模块中的某个(或全部)变量。

被引入变量不需要module.name来访问,仅需要name。

注意:不推荐引入全部变量,会引起名称空间污染。

+
-
In [58]:
+
In [61]:
-
from testmod import varible2
+
from testmod import varible2
 varible2
 
-
+
@@ -3058,13 +16237,15 @@

from import

-
Out[58]:
+
+
Out[61]:
-
-
-2
-
+ + + +
+
2
@@ -3073,27 +16254,24 @@

from import

- -
-
-
-
+
+
-

dir

-

列出某个模块的所有变量。

+

dir

列出某个模块的所有变量。

+
-
In [59]:
+
In [62]:
-
import testmod
+
import testmod
 dir(testmod)
 
-
+
@@ -3101,20 +16279,25 @@

dir

-
Out[59]:
+
+
Out[62]:
-
-
-['__builtins__',
- '__doc__',
- '__file__',
- '__name__',
- '__package__',
- 'add',
- 'varible1',
- 'varible2']
-
+ + + +
+
['__builtins__',
+ '__cached__',
+ '__doc__',
+ '__file__',
+ '__loader__',
+ '__name__',
+ '__package__',
+ '__spec__',
+ 'add',
+ 'varible1',
+ 'varible2']
@@ -3123,44 +16306,39 @@

dir

- -
-
-
-
+
+
-

模块预编译

-

当import时,python会试图去编译出pyc文件来。

+

模块预编译

当import时,python会试图去编译出pyc文件来。

pyc是被编译过的py文件,加载pyc文件可以跳过语法解析过程。

当py日期新于pyc时,重新生成pyc。所以日期紊乱可能导致执行老代码。

在Python3(3.2以后)中,会在当前目录下生成__pycache__目录,来缓存pyc文件。

这样可以避免多个Python解释器无法互相载入对方的pyc文件。

-

具体可以参考这里: https://docs.python.org/3/whatsnew/3.2.html

+

具体可以参考这里: https://docs.python.org/3/whatsnew/3.2.html

+
- +
-
In [60]:
+
In [63]:
-
!ls -l testmod*
+
!ls -l testmod*
 
-
+
@@ -3168,12 +16346,13 @@

模块预编译

-
-
-
--rw-r--r-- 1 shell shell 111 10月 28 20:06 testmod.py
--rw-r--r-- 1 shell shell 333 10月 28 20:06 testmod.pyc
+
+ + + +
+
-rw-r--r-- 1 shell shell 111 Mar 22 20:06 testmod.py
 
@@ -3184,13 +16363,13 @@

模块预编译

-
In [61]:
+
In [64]:
-
!ls -l __pycache__/testmod*
+
!ls -l __pycache__/testmod*
 
-
+
@@ -3198,11 +16377,14 @@

模块预编译

-
-
-
--rw-r--r-- 1 shell shell 356 10月 28 19:58 __pycache__/testmod.cpython-35.pyc
+
+ + + +
+
-rw-r--r-- 1 shell shell 365 Jun 25 2018 __pycache__/testmod.cpython-35.pyc
+-rw-r--r-- 1 shell shell 349 Mar 22 20:06 __pycache__/testmod.cpython-37.pyc
 
@@ -3211,36 +16393,32 @@

模块预编译

-
-
-
-
+
+
-

由于这个系统使用了python2作为基础,因此没有__pycache__。

+

由于这个系统使用了Python3作为基础,因此没有testmod.pyc文件。

+
- -
-
-
-
+
+
-

__name__属性

-

模块有一个属性,__name__。当这个属性为'__main__'时,说明当前模块被作为脚本运行。

+

__name__属性

模块有一个属性,__name__。当这个属性为'__main__'时,说明当前模块被作为脚本运行。

模块被作为以脚本运行时,不生成pyc文件(因为不是import)。

+
-
In [62]:
+
In [65]:
-
__name__
+
__name__
 
-
+
@@ -3248,13 +16426,15 @@

__name__属性

-
Out[62]:
+
+
Out[65]:
-
-
-'__main__'
-
+ + + +
+
'__main__'
@@ -3265,13 +16445,13 @@

__name__属性

-
In [63]:
+
In [66]:
-
testmod.__name__
+
testmod.__name__
 
-
+
@@ -3279,13 +16459,15 @@

__name__属性

-
Out[63]:
+
+
Out[66]:
-
-
-'testmod'
-
+ + + +
+
'testmod'
@@ -3294,25 +16476,22 @@

__name__属性

- -
-
-
-
+
+
-

Main文件模式化写法

+

Main文件模式化写法

-
In [64]:
+
In [67]:
-
!tail -n 2 testmod.py
+
!tail -n 2 testmod.py
 
-
+
@@ -3320,12 +16499,14 @@

Main文件模式化写法

-
+
+ + + +
-
-if __name__ == '__main__':
- print('run as script')
-
+
if __name__ == '__main__':
+ print('run as script')
@@ -3335,13 +16516,13 @@

Main文件模式化写法

-
In [65]:
+
In [68]:
-
!python testmod.py
+
!python testmod.py
 
-
+
@@ -3349,106 +16530,82 @@

Main文件模式化写法

-
-
-
-run as script
-
-
-
-
+
-
-
+ -
- -
-
-
In [66]:
-
-
-
!rm testmod*
-
-
+
+
run as script
+
-
- -
- -
+ +
+
+
-

Package

-

从组织结构上说,package是比modules更大一级的结构。

+

Package

从组织结构上说,package是比modules更大一级的结构。

一个package里可以包含多个modules和packages。

一般一个package是一个独立目录,里面有__init__.py文件。

这个文件指明了如何加载整个package。

+
- -
-
-
-
+
+
+
-

练习

-
    +

    练习

    • 导入系统sys模块
    • 列出sys模块中以s开头并且以e结尾的成员。
    +
- -
-
-
-
+
+
+
-

答案

+

答案

-
In [67]:
+
In [70]:
-
import sys
+
import sys
 for name in dir(sys):
 if name.startswith('s') and name.endswith('e'):
- print(name)
+ print(name)
 
-
+
@@ -3456,12 +16613,14 @@

答案

-
+
+ + + +
-
-setprofile
+
setprofile
 settrace
-
 
@@ -3469,81 +16628,71 @@

答案

-
-
-
- -
-
-
-
+
+
+
-

内置数据结构

-
    +

    内置数据结构

    • list
    • tuple
    • dict
    • set
    • string
    +
- -
-
-
-
+
+
-

list

-

具有顺序的一组对象。

+

list

具有顺序的一组对象。

可以随意访问其中的任意位置。

可以添加和删除。

其中的元素不需要是同类型。

+
- +
-
In [68]:
+
In [71]:
-
import sys
+
import sys
 shoplist = ['apple', 'mango', 'carrot', 'banana']
 
-print('I have {} items to purchase.'.format(len(shoplist)))
+print('I have {} items to purchase.'.format(len(shoplist)))
 sys.stdout.write('These items are: ')
 for item in shoplist:
 sys.stdout.write(str(item) + ' ')
 
-print('\nI also have to buy rice.')
+print('\nI also have to buy rice.')
 shoplist.append('rice')
-print('My shopping list is now {0}'.format(shoplist))
+print('My shopping list is now {0}'.format(shoplist))
 
-print('I will sort my list now')
+print('I will sort my list now')
 shoplist.sort()
-print('Sorted shopping list is {0}'.format(shoplist))
+print('Sorted shopping list is {0}'.format(shoplist))
 
-print('The first item I will buy is {0}'.format(shoplist[0]))
+print('The first item I will buy is {0}'.format(shoplist[0]))
 olditem = shoplist[0]
 del shoplist[0]
-print('I bought the {0}'.format(olditem))
-print('My shopping list is now {0}'.format(shoplist))
+print('I bought the {0}'.format(olditem))
+print('My shopping list is now {0}'.format(shoplist))
 
-
+
@@ -3551,19 +16700,21 @@

list

-
+
+ + + +
-
-I have 4 items to purchase.
+
I have 4 items to purchase.
 These items are: apple mango carrot banana 
 I also have to buy rice.
-My shopping list is now ['apple', 'mango', 'carrot', 'banana', 'rice']
+My shopping list is now ['apple', 'mango', 'carrot', 'banana', 'rice']
 I will sort my list now
-Sorted shopping list is ['apple', 'banana', 'carrot', 'mango', 'rice']
+Sorted shopping list is ['apple', 'banana', 'carrot', 'mango', 'rice']
 The first item I will buy is apple
 I bought the apple
-My shopping list is now ['banana', 'carrot', 'mango', 'rice']
-
+My shopping list is now ['banana', 'carrot', 'mango', 'rice']
 
@@ -3572,39 +16723,35 @@

list

- -
-
-
-
+
+
-

tuple

-

具有顺序的一组对象。

+

tuple

具有顺序的一组对象。

可以随意访问其中的任意位置。

不可以添加和删除。

其中的元素不需要是同类型。

+
-
-
In [69]:
+
In [72]:
-
zoo = ('python', 'elephant', 'penguin')
-print('Number of animals in the zoo is {0}'.format(len(zoo)))
+
zoo = ('python', 'elephant', 'penguin')
+print('Number of animals in the zoo is {0}'.format(len(zoo)))
 
 new_zoo = 'monkey', 'camel', zoo
-print('Number of cages in the new zoo is {0}'.format(len(new_zoo)))
+print('Number of cages in the new zoo is {0}'.format(len(new_zoo)))
 
-print('All animals in new zoo are {0}'.format(new_zoo))
-print('Animals brought from old zoo are {0}'.format(new_zoo[2]))
-print('Last animal brought from old zoo is {0}'.format(new_zoo[2][2]))
-print('Number of animals in the new zoo is {0}'.format(len(new_zoo)-1+len(new_zoo[2])))
+print('All animals in new zoo are {0}'.format(new_zoo))
+print('Animals brought from old zoo are {0}'.format(new_zoo[2]))
+print('Last animal brought from old zoo is {0}'.format(new_zoo[2][2]))
+print('Number of animals in the new zoo is {0}'.format(len(new_zoo)-1+len(new_zoo[2])))
 
-
+
@@ -3612,16 +16759,18 @@

tuple

-
+
+ + + +
-
-Number of animals in the zoo is 3
+
Number of animals in the zoo is 3
 Number of cages in the new zoo is 3
-All animals in new zoo are ('monkey', 'camel', ('python', 'elephant', 'penguin'))
-Animals brought from old zoo are ('python', 'elephant', 'penguin')
+All animals in new zoo are ('monkey', 'camel', ('python', 'elephant', 'penguin'))
+Animals brought from old zoo are ('python', 'elephant', 'penguin')
 Last animal brought from old zoo is penguin
 Number of animals in the new zoo is 5
-
 
@@ -3630,17 +16779,16 @@

tuple

-
-
In [70]:
+
In [73]:
-
r = 1, 2, 3
+
r = 1, 2, 3
 r
 
-
+
@@ -3648,13 +16796,15 @@

tuple

-
Out[70]:
+
+
Out[73]:
-
-
-(1, 2, 3)
-
+ + + +
+
(1, 2, 3)
@@ -3665,16 +16815,16 @@

tuple

-
In [71]:
+
In [74]:
-
a, b, c = r
-print(a)
-print(b)
-print(c)
+
a, b, c = r
+print(a)
+print(b)
+print(c)
 
-
+
@@ -3682,13 +16832,15 @@

tuple

-
+
+ + + +
-
-1
+
1
 2
 3
-
 
@@ -3699,15 +16851,15 @@

tuple

-
In [72]:
+
In [75]:
-
a, b = b, a
-print(a)
-print(b)
+
a, b = b, a
+print(a)
+print(b)
 
-
+
@@ -3715,12 +16867,14 @@

tuple

-
+
+ + + +
-
-2
+
2
 1
-
 
@@ -3729,14 +16883,10 @@

tuple

- -
-
-
-
+
+
-

操作序列对象

-
    +

    操作序列对象

    • 通过[]访问
    • 通过[]设定值
    • 通过for枚举
    • @@ -3744,37 +16894,37 @@

      操作序列对象

    • 通过[:]设定值
    • 通过[::]设定步进
    +
-
-
In [73]:
+
In [76]:
-
shoplist = ['apple', 'mango', 'carrot', 'banana']
+
shoplist = ['apple', 'mango', 'carrot', 'banana']
 name = 'swaroop'
-print('Item 0 is {0}'.format(shoplist[0]))
-print('Item 1 is {0}'.format(shoplist[1]))
-print('Item 2 is {0}'.format(shoplist[2]))
-print('Item 3 is {0}'.format(shoplist[3]))
-print('Item -1 is {0}'.format(shoplist[-1]))
-print('Item -2 is {0}'.format(shoplist[-2]))
-print('Character 0 is {0}'.format(name[0]))
-
-print('Item 1 to 3 is {0}'.format(shoplist[1:3]))
-print('Item 2 to end is {0}'.format(shoplist[2:]))
-print('Item 1 to -1 is {0}'.format(shoplist[1:-1]))
-print('Item start to end is {0}'.format(shoplist[:]))
-print('characters 1 to 3 is {0}'.format(name[1:3]))
-print('characters 2 to end is {0}'.format(name[2:]))
-print('characters 1 to -1 is {0}'.format(name[1:-1]))
-print('characters start to end is {0}'.format(name[:]))
-print('reversed characters is {0}'.format(name[::-1]))
+print('Item 0 is {0}'.format(shoplist[0]))
+print('Item 1 is {0}'.format(shoplist[1]))
+print('Item 2 is {0}'.format(shoplist[2]))
+print('Item 3 is {0}'.format(shoplist[3]))
+print('Item -1 is {0}'.format(shoplist[-1]))
+print('Item -2 is {0}'.format(shoplist[-2]))
+print('Character 0 is {0}'.format(name[0]))
+
+print('Item 1 to 3 is {0}'.format(shoplist[1:3]))
+print('Item 2 to end is {0}'.format(shoplist[2:]))
+print('Item 1 to -1 is {0}'.format(shoplist[1:-1]))
+print('Item start to end is {0}'.format(shoplist[:]))
+print('characters 1 to 3 is {0}'.format(name[1:3]))
+print('characters 2 to end is {0}'.format(name[2:]))
+print('characters 1 to -1 is {0}'.format(name[1:-1]))
+print('characters start to end is {0}'.format(name[:]))
+print('reversed characters is {0}'.format(name[::-1]))
 
-
+
@@ -3782,26 +16932,28 @@

操作序列对象

-
+
+ + + +
-
-Item 0 is apple
+
Item 0 is apple
 Item 1 is mango
 Item 2 is carrot
 Item 3 is banana
 Item -1 is banana
 Item -2 is carrot
 Character 0 is s
-Item 1 to 3 is ['mango', 'carrot']
-Item 2 to end is ['carrot', 'banana']
-Item 1 to -1 is ['mango', 'carrot']
-Item start to end is ['apple', 'mango', 'carrot', 'banana']
+Item 1 to 3 is ['mango', 'carrot']
+Item 2 to end is ['carrot', 'banana']
+Item 1 to -1 is ['mango', 'carrot']
+Item start to end is ['apple', 'mango', 'carrot', 'banana']
 characters 1 to 3 is wa
 characters 2 to end is aroop
 characters 1 to -1 is waroo
 characters start to end is swaroop
 reversed characters is pooraws
-
 
@@ -3810,54 +16962,47 @@

操作序列对象

- -
-
-
-
+
+
-

练习

-
    +

    练习

    1. 建立一个list,内容为10以内的所有质数。
    2. 计算出100内所有质数的列表。
    3. 将这个列表转为tuple。
    4. 根据上面的tuple,获得反转的tuple。
    5. 将一个list分为两个:第一个list拥有原本list前一半的反向,第二个list拥有原本list后一半的反向。
    +
- -
-
-
-
+
+
+
-

答案

+

答案

-
In [74]:
+
In [77]:
-
primes = [2, 3, 5, 7]
+
primes = [2, 3, 5, 7]
 primes
 
-
+
@@ -3865,13 +17010,15 @@

答案

-
Out[74]:
+
+
Out[77]:
-
-
-[2, 3, 5, 7]
-
+ + + +
+
[2, 3, 5, 7]
@@ -3880,24 +17027,23 @@

答案

-
-
In [75]:
+
In [78]:
-
for i in range(10, 100):
- prime = True
+
for i in range(10, 100):
+ prime = True
 for j in primes:
 if i % j == 0:
- prime = False
+ prime = False
 break
 if prime:
 primes.append(i)
-print(primes)
+print(primes)
 
-
+
@@ -3905,11 +17051,13 @@

答案

-
-
-
-[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
+
+ + + +
+
[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
 
@@ -3918,17 +17066,16 @@

答案

-
-
In [76]:
+
In [79]:
-
tuple_primes = tuple(primes)
-print(tuple_primes)
+
tuple_primes = tuple(primes)
+print(tuple_primes)
 
-
+
@@ -3936,11 +17083,13 @@

答案

-
-
-
-(2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97)
+
+ + + +
+
(2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97)
 
@@ -3949,16 +17098,15 @@

答案

-
-
In [77]:
+
In [80]:
-
print(tuple_primes[::-1])
+
print(tuple_primes[::-1])
 
-
+
@@ -3966,11 +17114,13 @@

答案

-
-
-
-(97, 89, 83, 79, 73, 71, 67, 61, 59, 53, 47, 43, 41, 37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2)
+
+ + + +
+
(97, 89, 83, 79, 73, 71, 67, 61, 59, 53, 47, 43, 41, 37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2)
 
@@ -3981,13 +17131,13 @@

答案

-
In [78]:
+
In [81]:
-
print(tuple(reversed(tuple_primes)))
+
print(tuple(reversed(tuple_primes)))
 
-
+
@@ -3995,11 +17145,13 @@

答案

-
-
-
-(97, 89, 83, 79, 73, 71, 67, 61, 59, 53, 47, 43, 41, 37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2)
+
+ + + +
+
(97, 89, 83, 79, 73, 71, 67, 61, 59, 53, 47, 43, 41, 37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2)
 
@@ -4008,18 +17160,17 @@

答案

-
-
In [79]:
+
In [82]:
-
# Python2下可以不需要int,因为len结果是整数,整数除法结果是整数。
+
# Python2下可以不需要int,因为len结果是整数,整数除法结果是整数。
 # 在Python3,没有int会导致出错。
 list(reversed(primes[:int(len(primes)/2)])), list(reversed(primes[int(len(primes)/2):]))
 
-
+
@@ -4027,14 +17178,16 @@

答案

-
Out[79]:
+
+
Out[82]:
-
-
-([37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2],
- [97, 89, 83, 79, 73, 71, 67, 61, 59, 53, 47, 43, 41])
-
+ + + +
+
([37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2],
+ [97, 89, 83, 79, 73, 71, 67, 61, 59, 53, 47, 43, 41])
@@ -4045,13 +17198,13 @@

答案

-
In [80]:
+
In [83]:
-
primes[int(len(primes)/2-1)::-1], primes[:int(len(primes)/2-1):-1]
+
primes[int(len(primes)/2-1)::-1], primes[:int(len(primes)/2-1):-1]
 
-
+
@@ -4059,14 +17212,16 @@

答案

-
Out[80]:
+
+
Out[83]:
-
-
-([37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2],
- [97, 89, 83, 79, 73, 71, 67, 61, 59, 53, 47, 43, 41])
-
+ + + +
+
([37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2],
+ [97, 89, 83, 79, 73, 71, 67, 61, 59, 53, 47, 43, 41])
@@ -4075,27 +17230,24 @@

答案

- -
-
-
-
+
+
-

列表推导式

+

列表推导式

-
In [81]:
+
In [84]:
-
l = range(12)
+
l = range(12)
 t = [i * i for i in l]
-print(t)
+print(t)
 
-
+
@@ -4103,11 +17255,13 @@

列表推导式

-
-
-
-[0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121]
+
+ + + +
+
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121]
 
@@ -4118,14 +17272,14 @@

列表推导式

-
In [82]:
+
In [85]:
-
t = [i * i for i in l if i % 2 != 0]
-print(t)
+
t = [i * i for i in l if i % 2 != 0]
+print(t)
 
-
+
@@ -4133,11 +17287,13 @@

列表推导式

-
-
-
-[1, 9, 25, 49, 81, 121]
+
+ + + +
+
[1, 9, 25, 49, 81, 121]
 
@@ -4146,72 +17302,75 @@

列表推导式

- -
-
-
-
+
+
-

练习

-

思考一下,列表推导式是否能够将素数列表直接实现出来?为什么?

+

练习

思考一下,列表推导式是否能够将素数列表直接实现出来?为什么?

然后自己测试一下。

+
- -
-
-
-
+
+
+
-

dict

-

具有一系列成对对象。一个叫做key,一个叫做value。

+

dict

具有一系列成对对象。一个叫做key,一个叫做value。

无顺序,key不可重复。

通过其中一个(key)可以唯一确定另外一个(value),反之未必。

可以添加和删除。

其中的元素(包括key和value)不需要是同类型。

key必须是不可变对象。

+
-
- +
-
In [83]:
+
In [86]:
-
ab = {
+
ab = {
 'Swaroop': 'swaroop@swaroopch.com',
 'Larry': 'larry@wall.org',
 'Matsumoto': 'matz@ruby-lang.org',
 'Spammer': 'spammer@hotmail.com'
 }
 
-print("Swaroop's address is {}".format(ab['Swaroop']))
+print("Swaroop's address is {}".format(ab['Swaroop']))
 del ab['Spammer']
 
-print('There are {} contacts in the address-book'.format(len(ab)))
-print('Name list: %s' % ', '.join(ab))
+print('There are {} contacts in the address-book'.format(len(ab)))
+print('Name list: %s' % ', '.join(ab))
 for name, address in ab.items():
- print('Contact {} at {}'.format(name, address))
+ print('Contact {} at {}'.format(name, address))
 
 ab['Guido'] = 'guido@python.org'
 if 'Guido' in ab:
- print("Guido's address is {}".format(ab['Guido']))
+ print("Guido's address is {}".format(ab['Guido']))
 
-
+
@@ -4219,17 +17378,19 @@

dict

-
+
+ + + +
-
-Swaroop's address is swaroop@swaroopch.com
+
Swaroop's address is swaroop@swaroopch.com
 There are 3 contacts in the address-book
-Name list: Swaroop, Matsumoto, Larry
+Name list: Swaroop, Larry, Matsumoto
 Contact Swaroop at swaroop@swaroopch.com
-Contact Matsumoto at matz@ruby-lang.org
 Contact Larry at larry@wall.org
-Guido's address is guido@python.org
-
+Contact Matsumoto at matz@ruby-lang.org
+Guido's address is guido@python.org
 
@@ -4238,31 +17399,27 @@

dict

- -
-
-
-
+
+
-

set

-

具有一组对象。无顺序,不可重复。

+

set

具有一组对象。无顺序,不可重复。

可以添加和删除。

其中的元素不需要是同类型,但必须是不可变对象。

+
-
-
In [84]:
+
In [87]:
-
bri = set(['brazil', 'russia', 'india'])
-bri = {'brazil', 'russia', 'india'} # python2.7以后可用
+
bri = set(['brazil', 'russia', 'india'])
+bri = {'brazil', 'russia', 'india'}
 'india' in bri
 
-
+
@@ -4270,13 +17427,15 @@

set

-
Out[84]:
+
+
Out[87]:
-
-
-True
-
+ + + +
+
True
@@ -4287,13 +17446,13 @@

set

-
In [85]:
+
In [88]:
-
'usa' in bri
+
'usa' in bri
 
-
+
@@ -4301,13 +17460,15 @@

set

-
Out[85]:
+
+
Out[88]:
-
-
-False
-
+ + + +
+
False
@@ -4318,16 +17479,16 @@

set

-
In [86]:
+
In [89]:
-
bric = bri.copy()
+
bric = bri.copy()
 bric.add('china')
-print(bric)
+print(bric)
 bric.issuperset(bri)
 
-
+
@@ -4335,22 +17496,26 @@

set

-
-
-
-set(['brazil', 'china', 'india', 'russia'])
+
+ + + +
+
{'china', 'russia', 'brazil', 'india'}
 
-
Out[86]:
+
+
Out[89]:
-
-
-True
-
+ + + +
+
True
@@ -4361,15 +17526,15 @@

set

-
In [87]:
+
In [90]:
-
bric.remove('russia')
-print(bric)
+
bric.remove('russia')
+print(bric)
 bri & bric
 
-
+
@@ -4377,22 +17542,26 @@

set

-
-
-
-set(['brazil', 'china', 'india'])
+
+ + + +
+
{'china', 'brazil', 'india'}
 
-
Out[87]:
+
+
Out[90]:
-
-
-{'brazil', 'india'}
-
+ + + +
+
{'brazil', 'india'}
@@ -4403,13 +17572,13 @@

set

-
In [88]:
+
In [91]:
-
bri | bric
+
bri | bric
 
-
+
@@ -4417,13 +17586,15 @@

set

-
Out[88]:
+
+
Out[91]:
-
-
-{'brazil', 'china', 'india', 'russia'}
-
+ + + +
+
{'brazil', 'china', 'india', 'russia'}
@@ -4432,14 +17603,10 @@

set

- -
-
-
-
+
+
-

string的一些其他方法

-
    +

    string的一些其他方法

    • startswith
    • endswith
    • in
    • @@ -4450,41 +17617,41 @@

      string的一些其他方法

    • join
    • split
    +
-
-
In [89]:
+
In [92]:
-
name = 'Swaroop'
+
name = 'Swaroop'
 if name.startswith('Swa'):
- print('Yes, the string starts with "Swa"')
+ print('Yes, the string starts with "Swa"')
 
 if 'a' in name:
- print('Yes, it contains the string "a"')
+ print('Yes, it contains the string "a"')
 
 pos = name.find('war')
 if pos != -1:
- print('position of the string "war" is %d' % pos)
+ print('position of the string "war" is %d' % pos)
 
-print("the string replace war to peace is %s" % name.replace('war', 'peace'))
-print("the string replace o to 0 is %s" % name.replace('o', '0'))
+print("the string replace war to peace is %s" % name.replace('war', 'peace'))
+print("the string replace o to 0 is %s" % name.replace('o', '0'))
 
-print("upper case: %s" % name.upper())
-print("lower case: %s" % name.lower())
+print("upper case: %s" % name.upper())
+print("lower case: %s" % name.lower())
 
 delimiter = '_*_'
 mylist = ['Brazil', 'Russia', 'India', 'China']
-print(delimiter.join(mylist))
+print(delimiter.join(mylist))
 
-print(delimiter.join(mylist).split(delimiter))
-print(delimiter.join(mylist).split('*'))
+print(delimiter.join(mylist).split(delimiter))
+print(delimiter.join(mylist).split('*'))
 
-
+
@@ -4492,20 +17659,22 @@

string的一些其他方法

-
+
+ + + +
-
-Yes, the string starts with "Swa"
-Yes, it contains the string "a"
-position of the string "war" is 1
+
Yes, the string starts with "Swa"
+Yes, it contains the string "a"
+position of the string "war" is 1
 the string replace war to peace is Speaceoop
 the string replace o to 0 is Swar00p
 upper case: SWAROOP
 lower case: swaroop
 Brazil_*_Russia_*_India_*_China
-['Brazil', 'Russia', 'India', 'China']
-['Brazil_', '_Russia_', '_India_', '_China']
-
+['Brazil', 'Russia', 'India', 'China']
+['Brazil_', '_Russia_', '_India_', '_China']
 
@@ -4514,52 +17683,46 @@

string的一些其他方法

- -
-
-
-
+
+
-

练习

-

每个国家都有一定的地区号码,现在我们知道这些国家和地区号码关系:

+

练习

每个国家都有一定的地区号码,现在我们知道这些国家和地区号码关系:

+30 希腊 +45 丹麦 +51 秘鲁 +65 新加坡 +86 中国

写代码求出以下电话号码里面有几个国家:

+86 1123 +65 1234 +51 2347 +30 9123 +65 1246 +30 2347 +86 2935

+
- -
-
-
-
+
+
-

答案

+

答案

-
In [90]:
+
In [93]:
-
number2country = {
- '+30': u'希腊',
- '+45': u'丹麦',
- '+51': u'秘鲁',
- '+65': u'新加坡',
- '+86': u'中国'
+
number2country = {
+ '+30': u'希腊',
+ '+45': u'丹麦',
+ '+51': u'秘鲁',
+ '+65': u'新加坡',
+ '+86': u'中国'
 }
 
 numbers = "+86 1123 +65 1234 +51 2347 +30 9123 +65 1246 +30 2347 +86 2935".split()
 country_set = set([number2country[n] for n in numbers if n.startswith('+')])
 
-print(len(country_set))
+print(len(country_set))
 # 注意:这里的输出顺序在不同的机器上可能不一样,具体依赖于python的版本和实现。set本身是没有顺序约定的。
-print(', '.join(country_set))
+print(', '.join(country_set))
 
-
+
@@ -4567,12 +17730,14 @@

答案

-
-
-
-4
-中国, 新加坡, 秘鲁, 希腊
+
+ + + +
+
4
+希腊, 秘鲁, 新加坡, 中国
 
@@ -4581,21 +17746,20 @@

答案

-
-
In [91]:
+
In [94]:
-
numbers = "+86 1123 +65 1234 +51 2347 +30 9123 +65 1246 +30 2347 +86 2935".split()
-print("numbers: %s" % str(numbers))
-print("filtered: %s" % str([n for n in numbers if n.startswith('+')]))
-print("filtered and mapped: %s" % ', '.join([number2country[n] for n in numbers if n.startswith('+')]))
+
numbers = "+86 1123 +65 1234 +51 2347 +30 9123 +65 1246 +30 2347 +86 2935".split()
+print("numbers: %s" % str(numbers))
+print("filtered: %s" % str([n for n in numbers if n.startswith('+')]))
+print("filtered and mapped: %s" % ', '.join([number2country[n] for n in numbers if n.startswith('+')]))
 country_set = set([number2country[n] for n in numbers if n.startswith('+')])
-print(', '.join(country_set))
+print(', '.join(country_set))
 
-
+
@@ -4603,14 +17767,16 @@

答案

-
+
+ + + +
-
-numbers: ['+86', '1123', '+65', '1234', '+51', '2347', '+30', '9123', '+65', '1246', '+30', '2347', '+86', '2935']
-filtered: ['+86', '+65', '+51', '+30', '+65', '+30', '+86']
+
numbers: ['+86', '1123', '+65', '1234', '+51', '2347', '+30', '9123', '+65', '1246', '+30', '2347', '+86', '2935']
+filtered: ['+86', '+65', '+51', '+30', '+65', '+30', '+86']
 filtered and mapped: 中国, 新加坡, 秘鲁, 希腊, 新加坡, 希腊, 中国
-中国, 新加坡, 秘鲁, 希腊
-
+希腊, 秘鲁, 新加坡, 中国
 
@@ -4618,24 +17784,17 @@

答案

-
-
-
- -
-
-
-
+
+
+
-

面对对象编程

+

面对对象编程

- -
-
-
-
+
+
+
-

class

-

如何定义类:

+

class

如何定义类:

+
-
In [92]:
+
In [95]:
-
class Person:
+
class Person:
 pass # An empty block
 
-
+
-
-
-
-
+
+

如何使用类产生对象:

+
-
In [93]:
+
In [96]:
-
p = Person()
-print(p)
+
p = Person()
+print(p)
 
-
+
@@ -4702,11 +17858,13 @@

class

-
-
-
-<__main__.Person instance at 0x7f7fbc419128>
+
+ + + +
+
<__main__.Person object at 0x7f13cc23b358>
 
@@ -4715,31 +17873,28 @@

class

- -
-
-
-
+
+
-

方法

-

如何定义类的成员方法:

+

方法

如何定义类的成员方法:

+
-
In [94]:
+
In [97]:
-
class Person:
+
class Person:
 def say_hi(self):
- print('Hello, how are you?')
+ print('Hello, how are you?')
 
 p = Person()
 p.say_hi()
 
-
+
@@ -4747,11 +17902,13 @@

方法

-
-
-
-Hello, how are you?
+
+ + + +
+
Hello, how are you?
 
@@ -4760,38 +17917,35 @@

方法

- -
-
-
-
+
+
-

数据

-

对象里包含的数据。

+

数据

对象里包含的数据。

可以用.访问。

和方法的主要差别在于。方法需要使用()来调用,而数据不需要。

+
-
In [95]:
+
In [98]:
-
class Person:
+
class Person:
 def set_name(self, name):
 self.name = name
 
 def say_hi(self):
- print('hello, {}, how are you?'.format(self.name))
+ print('hello, {}, how are you?'.format(self.name))
 
 p = Person()
 p.set_name('shell')
-print(p.name)
+print(p.name)
 p.say_hi()
 
-
+
@@ -4799,12 +17953,14 @@

数据

-
+
+ + + +
-
-shell
+
shell
 hello, shell, how are you?
-
 
@@ -4813,44 +17969,37 @@

数据

- -
-
-
-
+
+
-

self

-

在python中,成员函数使用"self"来指代对象自身。类似于java和C++中的"this"。

+

self

在python中,成员函数使用"self"来指代对象自身。类似于java和C++中的"this"。

在调用时,p.say_hi()即可。不需要传递p.say_hi(self)或者p.say_hi(p)。

在使用时,需要先将self定义为第一个参数。例如def say_hi(self):。

在函数内使用时,对象的成员需要用self.xx的方式使用,例如self.name。

self不是关键词,也不是强制名称。它只是函数的第一个参数。但是为了保持传统,请不要将他改为其他名称。

+
- -
-
-
-
+
+
-

__init__方法

-

__init__是对象的第一个方法,用于初始化对象数据。

+

__init__方法

__init__是对象的第一个方法,用于初始化对象数据。

__init__函数是初始化方法,而非构造方法。

在__init__函数被调用时,self对象已经创建完毕。

在python中,对象的属性可以自由添加删除,不需要先在类里面声明。

一般而言,对象里的所有数据会在__init__方法中赋值,后面可以变更。

但是不在__init__中赋值,后面直接赋值创建属性也是合法的。

+
-
-
In [96]:
+
In [99]:
-
class Person:
+
class Person:
 def __init__(self, name):
 self.name = name
 
@@ -4858,18 +18007,18 @@ 

__init__方法

self.name = name def say_hi(self): - print('hello, {}, how are you?'.format(self.name)) + print('hello, {}, how are you?'.format(self.name)) p = Person('Swaroop') -print(p.name) +print(p.name) p.say_hi() p.set_name('shell') -print(p.name) +print(p.name) p.say_hi()
-
+
@@ -4877,14 +18026,16 @@

__init__方法

-
+
+ + + +
-
-Swaroop
+
Swaroop
 hello, Swaroop, how are you?
 shell
 hello, shell, how are you?
-
 
@@ -4893,33 +18044,27 @@

__init__方法

- -
-
-
-
+
+
-

练习

-

定义一个马克杯类,定义一个加水方法和一个喝水方法。

+

练习

定义一个马克杯类,定义一个加水方法和一个喝水方法。

+
- -
-
-
-
+
+
-

答案

+

答案

-
In [97]:
+
In [100]:
-
class Mug:
+
class Mug:
 
 def __init__(self):
 self.water = 0
@@ -4931,43 +18076,38 @@ 

答案

self.water += mass
-
+
- -
-
-
-
+
+
-

类成员和对象成员

-

类和对象分别拥有成员,例如数据和方法。

+

类成员和对象成员

类和对象分别拥有成员,例如数据和方法。

对象可以引用类成员,例如p.say_hi()。也可以引用对象成员,或者self.name。

当有重名时优先引用对象成员。

类成员在所有对象间共享,而对象成员只是它自己的。

+
- +
-
In [98]:
+
In [101]:
-
class Robot:
+
class Robot:
 """Represents a robot, with a name."""
 
 # A class variable, counting the number of robots
@@ -4976,44 +18116,43 @@ 

类成员和对象成员

def __init__(self, name): """Initializes the data.""" self.name = name - print("(Initializing {})".format(self.name)) + print("(Initializing {})".format(self.name)) # When this person is created, the robot # adds to the population Robot.population += 1 def die(self): """I am dying.""" - print("{} is being destroyed!".format(self.name)) + print("{} is being destroyed!".format(self.name)) Robot.population -= 1 if Robot.population == 0: - print("{} was the last one.".format(self.name)) + print("{} was the last one.".format(self.name)) else: - print("There are still {:d} robots working.".format( + print("There are still {:d} robots working.".format( Robot.population)) def say_hi(self): """Greeting by the robot. Yeah, they can do that.""" - print("Greetings, my masters call me {}.".format(self.name)) + print("Greetings, my masters call me {}.".format(self.name)) @classmethod - def how_many(cls): + def how_many(cls): """Prints the current population.""" - print("We have {:d} robots.".format(cls.population)) + print("We have {:d} robots.".format(cls.population))
-
+
-
-
In [99]:
+
In [102]:
-
droid1 = Robot("R2-D2")
+
droid1 = Robot("R2-D2")
 droid1.say_hi()
 Robot.how_many()
 
@@ -5021,16 +18160,16 @@ 

类成员和对象成员

droid2.say_hi() Robot.how_many() -print("\nRobots can do some work here.\n") +print("\nRobots can do some work here.\n") -print("Robots have finished their work. So let's destroy them.") +print("Robots have finished their work. So let's destroy them.") droid1.die() droid2.die() Robot.how_many()
-
+
@@ -5038,10 +18177,13 @@

类成员和对象成员

-
+
+ + + +
-
-(Initializing R2-D2)
+
(Initializing R2-D2)
 Greetings, my masters call me R2-D2.
 We have 1 robots.
 (Initializing C-3PO)
@@ -5050,13 +18192,12 @@ 

类成员和对象成员

Robots can do some work here. -Robots have finished their work. So let's destroy them. +Robots have finished their work. So let's destroy them. R2-D2 is being destroyed! There are still 1 robots working. C-3PO is being destroyed! C-3PO was the last one. We have 0 robots. -
@@ -5065,34 +18206,28 @@

类成员和对象成员

- -
-
-
-
+
+
-

练习

-

回想一下,上一节你的定义里是否考虑了马克杯的"最大容量"。如果没有,请加上。

+

练习

回想一下,上一节你的定义里是否考虑了马克杯的"最大容量"。如果没有,请加上。

思考一下,"最大容量"是对象属性还是类属性,为什么?

+
- -
-
-
-
+
+
-

答案

+

答案

-
In [100]:
+
In [103]:
-
class Mug:
+
class Mug:
 
 capacity = 300
 
@@ -5110,86 +18245,81 @@ 

答案

self.water = self.capacity
-
+
- -
-
-
-
+
+
-

继承

-

继承关系分为基类和继承类(也叫父类和子类)。

+

继承

继承关系分为基类和继承类(也叫父类和子类)。

子类可以继承父类的成员。当子类和父类定义同名成员时,优先引用子类的。

原则上说,父类能做的事,子类一定能做(虽然行为可能有差异)。父类能出现的地方,子类一定能出现。

因为子类拥有父类的所有成员。

继承的写法为:

+
class Person(Animal):
- pass
-
+ pass +
-
-
In [101]:
+
In [104]:
-
class SchoolMember:
+
class SchoolMember:
 '''Represents any school member.'''
 def __init__(self, name, age):
 self.name = name
 self.age = age
- print('(Initialized SchoolMember: {})'.format(self.name))
+ print('(Initialized SchoolMember: {})'.format(self.name))
 
 def tell(self):
 '''Tell my details.'''
- print('Name:"{}" Age:"{}"'.format(self.name, self.age))
+ print('Name:"{}" Age:"{}"'.format(self.name, self.age))
 
 
 class Teacher(SchoolMember):
 '''Represents a teacher.'''
 def __init__(self, name, age, salary):
- SchoolMember.__init__(self, name, age)
+ SchoolMember.__init__(self, name, age)
 self.salary = salary
- print('(Initialized Teacher: {})'.format(self.name))
+ print('(Initialized Teacher: {})'.format(self.name))
 
 def tell(self):
 SchoolMember.tell(self)
- print('Salary: "{:d}"'.format(self.salary))
+ print('Salary: "{:d}"'.format(self.salary))
 
-
+
-
-
In [102]:
+
In [105]:
-
class Student(SchoolMember):
+
class Student(SchoolMember):
 '''Represents a student.'''
 def __init__(self, name, age, marks):
- SchoolMember.__init__(self, name, age)
+ SchoolMember.__init__(self, name, age)
 self.marks = marks
- print('(Initialized Student: {})'.format(self.name))
+ print('(Initialized Student: {})'.format(self.name))
 
 def tell(self):
 SchoolMember.tell(self)
- print('Marks: "{:d}"'.format(self.marks))
+ print('Marks: "{:d}"'.format(self.marks))
 
 t = Teacher('Mrs. Shrividya', 40, 30000)
 s = Student('Swaroop', 25, 75)
 
 # prints a blank line
-print()
+print()
 
 members = [t, s]
 for member in members:
@@ -5197,7 +18327,7 @@ 

继承

member.tell()
-
+
@@ -5205,19 +18335,21 @@

继承

-
+
+ + + +
-
-(Initialized SchoolMember: Mrs. Shrividya)
+
(Initialized SchoolMember: Mrs. Shrividya)
 (Initialized Teacher: Mrs. Shrividya)
 (Initialized SchoolMember: Swaroop)
 (Initialized Student: Swaroop)
-()
-Name:"Mrs. Shrividya" Age:"40"
-Salary: "30000"
-Name:"Swaroop" Age:"25"
-Marks: "75"
 
+Name:"Mrs. Shrividya" Age:"40"
+Salary: "30000"
+Name:"Swaroop" Age:"25"
+Marks: "75"
 
@@ -5226,33 +18358,27 @@

继承

- -
-
-
-
+
+
-

练习

-

请为马克杯增加一个"添满"方法,可以求出需要添多少水到加满,并自动为杯子加水。

+

练习

请为马克杯增加一个"添满"方法,可以求出需要添多少水到加满,并自动为杯子加水。

+
- -
-
-
-
+
+
-

答案

+

答案

-
In [103]:
+
In [106]:
-
class Mug(object):
+
class Mug(object):
 capacity = 300
 
 def __init__(self):
@@ -5273,51 +18399,42 @@ 

答案

self.watering(mass)
-
+
- -
-
-
-
+
+
-

练习

-

请定义一个运动杯类,并同样实现"喝水","加水"和"添满"方法。

+

练习

请定义一个运动杯类,并同样实现"喝水","加水"和"添满"方法。

+
- -
-
-
-
+
+
-

练习

-

考虑一下,如果"马克杯"和"运动杯"的"喝水"和"添水"行为是不一样的。

+

练习

考虑一下,如果"马克杯"和"运动杯"的"喝水"和"添水"行为是不一样的。

那么,"添满"行为是否一样,两边是否可以重用"添满"?

如果可以,怎么做?

+
- -
-
-
-
+
+
-

答案

+

答案

-
In [104]:
+
In [107]:
-
class Cup(object):
+
class Cup(object):
 
 def __init__(self):
 self.water = 0
@@ -5353,29 +18470,28 @@ 

答案

self.water = self.capacity
-
+
-
-
In [105]:
+
In [108]:
-
m = Mug()
+
m = Mug()
 m.full()
 m.drink(100)
-print(m.water)
+print(m.water)
 
 s = SportBottle()
 s.full()
 s.drink(100)
-print(s.water)
+print(s.water)
 
-
+
@@ -5383,12 +18499,14 @@

答案

-
+
+ + + +
-
-200
+
200
 400
-
 
@@ -5396,43 +18514,30 @@

答案

-
-
-
- -
-
-
-
+
+
+
-

输入输出

+

输入输出

- -
-
-
-
+
+
-

从命令行输入

-

python3使用input从命令行输入。python2使用raw_input从命令行输入。

+

从命令行输入

Python3使用input从命令行输入。Python2使用raw_input从命令行输入。

两者参数一致,都是一个提示字符串。

-

在python2中,input是eval(input),有安全性问题。

+

在Python2中,input是eval(input),有安全性问题。

+
-
-
In [106]:
+
In [109]:
-
#Rise to vote, sir.
-try:
- input = raw_input
-except NameError:
- pass
+
#Rise to vote, sir.
 
 def reverse(text):
 return text[::-1]
@@ -5443,12 +18548,12 @@ 

从命令行输入

something = input("Enter text: ") if is_palindrome(something): - print("Yes, it is a palindrome") + print("Yes, it is a palindrome") else: - print("No, it is not a palindrome") + print("No, it is not a palindrome")
-
+
@@ -5456,12 +18561,14 @@

从命令行输入

-
+
+ + + +
-
-Enter text: Rise to vote, sir.
+
Enter text: abc
 No, it is not a palindrome
-
 
@@ -5470,41 +18577,30 @@

从命令行输入

- -
-
-
-
+
+
-

练习

-

刚刚的回文字符串程序只能检测纯粹的字符串,真正的回文字符检测程序应当能够处理标点,空格和大小写。

-

例如"Rise to vote, sir."实际上也是回文字符串,但是刚刚的程序判定他不是。

+

练习

刚刚的回文字符串程序只能检测纯粹的字符串,真正的回文字符检测程序应当能够处理标点,空格和大小写。

+

例如"Rise to vote, sir."实际上也是回文字符串,但是刚刚的程序判定他不是。

请写出一个新的版本。

简单起见,只需要处理,和.即可。先不用管理各种复杂标点,例如&。

+
- -
-
-
-
+
+
-

答案

+

答案

-
In [107]:
+
In [110]:
-
try:
- input = raw_input
-except NameError:
- pass
-
-def reverse(text):
+
def reverse(text):
 return text[::-1]
 
 def is_palindrome(text):
@@ -5517,12 +18613,12 @@ 

答案

something = input("Enter text: ") if is_palindrome(something): - print("Yes, it is a palindrome") + print("Yes, it is a palindrome") else: - print("No, it is not a palindrome") + print("No, it is not a palindrome")
-
+
@@ -5530,12 +18626,14 @@

答案

-
+
+ + + +
-
-Enter text: Rise to vote, sir.
+
Enter text: Rise to vote, sir.
 Yes, it is a palindrome
-
 
@@ -5544,24 +18642,20 @@

答案

- -
-
-
-
+
+
-

从文件中输入输出

-

使用open打开文件进行读写。调用方法和C的fopen类似。

+

从文件中输入输出

使用open打开文件进行读写。调用方法和C的fopen类似。

+
-
-
In [108]:
+
In [111]:
-
import sys
+
import sys
 poem = '''\
 Programming is fun
 When the work is done
@@ -5573,7 +18667,7 @@ 

从文件中输入输出

f.close() f = open('poem.txt') -while True: +while True: line = f.readline() if len(line) == 0: break @@ -5581,7 +18675,7 @@

从文件中输入输出

f.close()
-
+
@@ -5589,14 +18683,16 @@

从文件中输入输出

-
+
+ + + +
-
-Programming is fun
+
Programming is fun
 When the work is done
 if you wanna make your work also fun:
 use Python!
-
 
@@ -5605,16 +18701,15 @@

从文件中输入输出

-
-
In [109]:
+
In [112]:
-
!ls -l poem.txt
+
!ls -l poem.txt
 
-
+
@@ -5622,11 +18717,13 @@

从文件中输入输出

-
-
-
--rw-r--r-- 1 shell shell 95 10月 28 20:07 poem.txt
+
+ + + +
+
-rw-r--r-- 1 shell shell 95 Mar 22 20:06 poem.txt
 
@@ -5637,13 +18734,13 @@

从文件中输入输出

-
In [110]:
+
In [113]:
-
!cat poem.txt
+
!cat poem.txt
 
-
+
@@ -5651,14 +18748,16 @@

从文件中输入输出

-
+
+ + + +
-
-Programming is fun
+
Programming is fun
 When the work is done
 if you wanna make your work also fun:
 use Python!
-
 
@@ -5667,57 +18766,47 @@

从文件中输入输出

-
-
-
-
+
+

以上皆是linux指令,因此不能(也不需要)在windows上执行。windows上对应的行为为dir,type,和del。

+
-
-
-
- -
-
-
-
+
+
+
-

异常

+

异常

- -
-
-
-
+
+
-

简介

-

Python允许在出现错误的时候,"抛"出这个错误。

+

简介

Python允许在出现错误的时候,"抛"出这个错误。

错误按照调用顺序依次向上找,找到第一个合适的处理方法对错误进行处理。如果无人处理错误,则程序崩溃。

这种错误处理机制允许调用者对函数深层的错误进行容错,同时中间所有代码对这个过程无需干预。

-
>>> Print("Hello World")
+
+
>>> Print("Hello World")
 Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
-NameError: name 'Print' is not defined
->>> print("Hello World")
-Hello World
-
+ File "<stdin>", line 1, in <module> +NameError: name 'Print' is not defined +>>> print("Hello World") +Hello World
+
-
-
In [111]:
+
In [114]:
-
Print("Hello World")
+
Print("Hello World")
 
-
+
@@ -5725,15 +18814,19 @@

简介

-
-
+
+ + + + +
----------------------------------------------------------------------------
-NameError Traceback (most recent call last)
-<ipython-input-111-4a9fe39e6a16> in <module>()
-----> 1Print("Hello World")
+---------------------------------------------------------------------------
+NameError Traceback (most recent call last)
+<ipython-input-114-82ee0b7fee85> in <module>()
+----> 1Print("Hello World")
 
-NameError: name 'Print' is not defined
+NameError: name 'Print' is not defined
@@ -5743,13 +18836,13 @@

简介

-
In [112]:
+
In [115]:
-
print("Hello World")
+
print("Hello World")
 
-
+
@@ -5757,11 +18850,13 @@

简介

-
-
-
-Hello World
+
+ + + +
+
Hello World
 
@@ -5770,39 +18865,35 @@

简介

- -
-
-
-
+
+
-

异常输出阅读

-

python的大多数错误会伴随抛出异常。因此,为了解决日常在使用中碰到的种种问题,我们需要学会如何阅读异常。

+

异常输出阅读

python的大多数错误会伴随抛出异常。因此,为了解决日常在使用中碰到的种种问题,我们需要学会如何阅读异常。

异常输出通常和函数的调用顺序相同,和栈的顺序相反。

最上层的调用(最先发生的)在最上面,最后执行到的地方在最下面。最后一个异常行就是异常发生的精确地点。

最后一行是异常的名字和参数。

+
-
-
In [113]:
+
In [116]:
-
def layer1():
- print('layer1 called')
+
def layer1():
+ print('layer1 called')
 return layer2()
 
 def layer2():
- print('layer2 called')
+ print('layer2 called')
 raise Exception('arg1', 2)
 return 1
 
-print(layer1())
+print(layer1())
 
-
+
@@ -5810,41 +18901,47 @@

异常输出阅读

-
+
+ + + +
-
-layer1 called
+
layer1 called
 layer2 called
-
 
-
-
+
+ + + + +
----------------------------------------------------------------------------
-Exception Traceback (most recent call last)
-<ipython-input-113-22bfd87adf46> in <module>()
- 8 return 1
- 9 
----> 10print(layer1())
+---------------------------------------------------------------------------
+Exception Traceback (most recent call last)
+<ipython-input-116-ee9e317c1a37> in <module>()
+ 8 return 1
+ 9 
+---> 10print(layer1())
 
-<ipython-input-113-22bfd87adf46> in layer1()
- 1 def layer1():
- 2 print('layer1 called')
-----> 3return layer2()
- 4 
- 5 def layer2():
+<ipython-input-116-ee9e317c1a37> in layer1()
+ 1 def layer1():
+ 2 print('layer1 called')
+----> 3return layer2()
+ 4 
+ 5 def layer2():
 
-<ipython-input-113-22bfd87adf46> in layer2()
- 5 def layer2():
- 6 print('layer2 called')
-----> 7raise Exception('arg1', 2)
- 8 return 1
- 9 
+<ipython-input-116-ee9e317c1a37> in layer2()
+ 5 def layer2():
+ 6 print('layer2 called')
+----> 7raise Exception('arg1', 2)
+ 8 return 1
+ 9 
 
-Exception: ('arg1', 2)
+Exception: ('arg1', 2)
@@ -5852,40 +18949,31 @@

异常输出阅读

- -
-
-
-
+
+
-

异常处理

-

常规异常处理代码段需要包含三部分内容:被监管代码体,错误类型和异常处理代码体。

+

异常处理

常规异常处理代码段需要包含三部分内容:被监管代码体,错误类型和异常处理代码体。

当被监管代码体中发生异常时,异常被向上抛出。

向上寻找处理函数的异常属于定义的这个错误类的子类时,异常处理代码体被调用。

一般来说,除非明确知道确实要捕获所有异常,否则严禁用捕获所有异常来处理某种特定问题。

+
-
-
In [114]:
+
In [117]:
-
try:
- input = raw_input
-except NameError:
- pass
-
-try:
+
try:
 number = int(input('Enter something --> '))
 except ValueError:
- print('Illegal number')
+ print('Illegal number')
 else:
- print(number+1)
+ print(number+1)
 
-
+
@@ -5893,12 +18981,14 @@

异常处理

-
+
+ + + +
-
-Enter something --> 10.a
+
Enter something --> abc
 Illegal number
-
 
@@ -5907,14 +18997,10 @@

异常处理

- -
-
-
-
+
+
-

常见异常

-
    +

    常见异常

    • AttributeError
    • ImportError
    • IndexError
    • @@ -5925,35 +19011,33 @@

      常见异常

    • TypeError
    • ValueError
    +
- -
-
-
-
+
+
-

抛出异常

+

抛出异常

-
In [115]:
+
In [118]:
-
def f():
- print("I'm ok")
+
def f():
+ print("I'm ok")
 raise Exception('actually not')
 
 try:
 f()
 except Exception as err:
- print(err)
+ print(err)
 
-
+
@@ -5961,12 +19045,14 @@

抛出异常

-
+
+ + + +
-
-I'm ok
+
I'm ok
 actually not
-
 
@@ -5975,57 +19061,49 @@

抛出异常

- -
-
-
-
+
+
-

自定义异常

+

自定义异常

-
In [116]:
+
In [119]:
-
# 必须自Exception中继承
+
# 必须自Exception中继承
 class ShortInputException(Exception):
 '''A user-defined exception class.'''
 def __init__(self, length, atleast):
- Exception.__init__(self)
+ Exception.__init__(self)
 self.length = length
 self.atleast = atleast
 
-
+
-
In [117]:
+
In [120]:
-
try:
- input = raw_input
-except NameError:
- pass
-
-try:
+
try:
 text = input('Enter something --> ')
 if len(text) < 3:
 raise ShortInputException(len(text), 3)
 except ShortInputException as ex:
- print('ShortInputException: The input was {0} long, expected at least {1}'.format(
+ print('ShortInputException: The input was {0} long, expected at least {1}'.format(
 ex.length, ex.atleast))
 else:
- print('No exception was raised.')
+ print('No exception was raised.')
 
-
+
@@ -6033,12 +19111,14 @@

自定义异常

-
+
+ + + +
-
-Enter something --> 1
+
Enter something --> a
 ShortInputException: The input was 1 long, expected at least 3
-
 
@@ -6047,40 +19127,31 @@

自定义异常

- -
-
-
-
+
+
-

finally

-

finally用于"无论是异常还是正常,以下内容必然被执行"的情况。

+

finally

finally用于"无论是异常还是正常,以下内容必然被执行"的情况。

多用于清理。

+
-
-
In [118]:
+
In [121]:
-
try:
- input = raw_input
-except NameError:
- pass
-
-try:
+
try:
 number = int(input('Enter something --> '))
 except ValueError:
- print('Illegal number')
+ print('Illegal number')
 else:
- print(number+1)
+ print(number+1)
 finally:
- print('(clean up here)')
+ print('(clean up here)')
 
-
+
@@ -6088,13 +19159,15 @@

finally

-
+
+ + + +
-
-Enter something --> 10.a
+
Enter something --> abc
 Illegal number
 (clean up here)
-
 
@@ -6103,30 +19176,27 @@

finally

- -
-
-
-
+
+
-

with

-

with可以在推出区块时自动关闭文件,而且对异常安全(异常在下一节讲)。

+

with

with可以在推出区块时自动关闭文件,而且对异常安全(异常在下一节讲)。

with不仅可以用于文件,而且可以用于很多需要在离开区域时自动关闭的对象,例如锁。

+
-
In [119]:
+
In [122]:
-
import sys
+
import sys
 with open("poem.txt") as f:
 for line in f:
 sys.stdout.write(line)
 
-
+
@@ -6134,14 +19204,16 @@

with

-
+
+ + + +
-
-Programming is fun
+
Programming is fun
 When the work is done
 if you wanna make your work also fun:
 use Python!
-
 
@@ -6149,41 +19221,23 @@

with

-
- -
-
-
In [120]:
-
-
-
!rm -f poem.txt
-
- -
-
-
- -
-
- -
-
-
-
+
+
+
-

assert

+

assert

-
In [121]:
+
In [124]:
-
assert 1 == 0, Exception('of course')
+
assert 1 == 0, Exception('of course')
 
-
+
@@ -6191,96 +19245,76 @@

assert

-
-
+
+ + + + +
----------------------------------------------------------------------------
-AssertionError Traceback (most recent call last)
-<ipython-input-121-53f9edc366b8> in <module>()
-----> 1assert 1 == 0, Exception('of course')
+---------------------------------------------------------------------------
+AssertionError Traceback (most recent call last)
+<ipython-input-124-edbb3195c18c> in <module>()
+----> 1assert 1 == 0, Exception('of course')
 
-AssertionError: of course
+AssertionError: of course
-
-
-
- -
-
-
-
+
+
+
-

文档

+

文档

- -
-
-
-
+
+
-

文档获得和查阅

-

在线文档:

-

https://docs.python.org/2/

-

https://docs.python.org/3/

+

文档获得和查阅

在线文档:

+

https://docs.python.org/3/

本地文档:随安装版本变化。

两者冲突以本地为准,本地一定对应安装使用的版本。

库查Library Reference,这是最主要部分。

语法特性查Language Reference。

+
- -
-
-
-
+
+
-

练习

-

打开文档,请查阅itertools.permutations的意义,参数,返回值,用法,注意要点等信息。并向大家解释。

+

练习

打开文档,请查阅itertools.permutations的意义,参数,返回值,用法,注意要点等信息。并向大家解释。

+
- -
-
-
-
+
+
-

第三方文档查询

-

没有什么固定方法。

+

第三方文档查询

没有什么固定方法。

在google(注意,不是baidu)上搜索关键词。找一个比较像的官网。找到文档。

可以参考pypi,很多第三方库可以在上面找到。里面往往带有文档地址。

缺点是,pypi上搜出来的重名库太多,很难搞清楚哪个才是你要的。

+
-
-
-
- -
-
-
-
+
+
+
-

Python2和Python3的差异

+

Python2和Python3的差异

- -
-
-
-
+
+
-

简述

-

Python2中有很多固有的设计问题,例如:

+

简述

Python2中有很多固有的设计问题,例如:

  1. print是内置关键词。一般来说,关键词越少越好,因为关键词越少,语言的内核越简洁。
  2. 混同了bytes和unicode。
  3. @@ -6290,14 +19324,12 @@

    简述

    常规来说,修复问题最重要的是"向下兼容,逐步进行"。

    然而上述问题几乎全部都是语言本质问题,不对语言进行伤筋动骨的大改是没有办法修复的。

    因此Python3的预订是"不和Python2兼容",这造成了Python社区目前2/3分裂的现状。

    +
- -
-
-
-
+
+

Python2和Python3有很多细节差异。但是大致来说,最主要就是上面提到的三项。

    @@ -6307,266 +19339,224 @@

    简述

在下面这个连接里,收录了Python2和Python3的其他一些细节差异。

https://wiki.python.org/moin/Python2orPython3

+
- -
-
-
-
+
+
-

Python2到3迁移

-

Python3带有2to3脚本,可以完成很多项目的迁移。

+

Python2到3迁移

Python3带有2to3脚本,可以完成很多项目的迁移。

但是对于某些情况,他仍然不能自动的完成所有工作。

2到3迁移的主要问题在于,目前有很多库,仍然没有完成Python3的迁移工作。这导致使用这些库编写的程序很难在Python3上找到更好的(或者更习惯的)替代产品。

而这件事情是2to3脚本无法自动完成的。

+
- -
-
-
-
-
-

我该用哪个版本/哪个更好

-

任何能让你不添加额外的麻烦把工作做下来的版本都是好的。

-

如果Python2和Python3一样好,那么Python3更好。

-

因为很显然,Python社区已经宣布Python2将停止维护。在可见的时间内,显然都要使用Python3的写法。

-

如果能够不添加额外麻烦的情况下使用Python3,这可能为将来的维护带来便利。

-
-
-
-
-
- -
- -
+
+
+
-

第三方软件安装

-

两套基本系统:

+

第三方软件安装

两套基本系统:

  • setuptools
  • pip
+
- -
-
-
-
+
+
-

setuptools

-

系统中必须安装了setuptools(请咨询管理员安装),或者使用以下指令安装:

+

setuptools

系统中必须安装了setuptools(请咨询管理员安装),或者使用以下指令安装:

Linux:

+
wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python
-

MacOS:

-
curl https://bootstrap.pypa.io/ez_setup.py -o - | python
+
 
+

MacOS:

+ +
curl https://bootstrap.pypa.io/ez_setup.py -o - | python
+
- -
-
-
-
+
+
-

setuptools的使用

-
    +

    setuptools的使用

    1. easy_install 包名
    2. easy_install 安装包路径。(路径可以填写一个url,系统会从网络上下载安装)
    3. 在软件的分发包中找到setup.py,直接运行python setup.py install

    进一步资料请参考:https://setuptools.readthedocs.io/en/latest/easy_install.html

    +
- -
-
-
-
+
+
-

pip

-

系统中必须有pip,具体请咨询管理员。或者下载该文件:

+

pip

系统中必须有pip,具体请咨询管理员。或者下载该文件:

https://bootstrap.pypa.io/get-pip.py

使用python执行安装(注意需要管理员权限)。

+
- -
-
-
-
+
+
-

pip的使用

-
    +

    pip的使用

    1. pip install 包名
    2. pip install -r requirements.txt (自动处理里面的所有依赖)
    +
- -
-
-
-
+
+
-

virtualenv

-

功能:用于隔离出一套独立的环境,可以在里面安装各种包,而不对系统造成影响。

+

virtualenv

功能:用于隔离出一套独立的环境,可以在里面安装各种包,而不对系统造成影响。

使用场景:可以在用户目录中安装包,无需系统权限。也可以隔离多个环境,安装不同版本的不同程序。

限制:virtualenv本身,及其依赖的Python是无法隔离的。

+
- -
-
-
-
+
+
-

virtualenv的使用

-

建立环境:virtualenv 目录名

+

virtualenv的使用

建立环境:virtualenv 目录名

激活环境:进入目录后执行source bin/activate

退出激活环境:deactivate

隔离环境内的安装:pip或者setup.py均可

注意:安装库时需要编译的,系统中必须有编译工具链。

+
- -
-
-
-
+
+
-

访问系统库

-

如果在使用virtualenv的同时,也想使用系统中安装的库。那么需要在创建环境时用--system-site-packages参数。

+

访问系统库

如果在使用virtualenv的同时,也想使用系统中安装的库。那么需要在创建环境时用--system-site-packages参数。

从工程管理角度,我们不推荐这种办法。建议将系统中的所有库在虚环境中再安装一次。

+
- -
-
-
-
+
+
-

虚拟环境的发布

-

使用virtualenv生成的虚拟环境可以迁移到其他机器上,从而允许将运行环境在多台机器上迁移。但是需要注意以下事项:

+

虚拟环境的发布

使用virtualenv生成的虚拟环境可以迁移到其他机器上,从而允许将运行环境在多台机器上迁移。但是需要注意以下事项:

  • virtualenv依赖于目录工作,所以所有机器上virtualenv必须处于同一路径下。
  • virtualenv不能隔离系统/Python基础环境。因此所有机器必须同构,并且Python环境基本一致。
  • 里面所安装的库所依赖的其他系统文件,例如动态运行库,数据文件。如果不在virtualenv里安装的,则每个系统上均需要自行安装。
+
- -
-
-
-
+
+
-

更进一步资料

-

请参考这里:

+

更进一步资料

请参考这里:

https://virtualenv.pypa.io/en/stable/userguide/

+
- -
-
-
-
+
+
-

软件包安装和管理建议

-

Python默认情况下会试图将软件包安装到系统里,如果不具备管理员权限,需要使用virtualenv来安装软件包。

+

软件包安装和管理建议

Python默认情况下会试图将软件包安装到系统里,如果不具备管理员权限,需要使用virtualenv来安装软件包。

对于Debian/Ubuntu而言,安装软件的第一选择是apt系统。如果找不到包,或版本不对,建议采用virtualenv + pip的方式安装。

对于RHEL/CentOS而言,安装软件的第一选择是yum系统。如果找不到包,或版本不对,建议采用virtualenv + pip的方式安装。

对于Windows/MacOS而言,建议使用virtualenv + pip的方式安装。

+
-
-
+
- - - - - - - - - - - -

AltStyle によって変換されたページ (->オリジナル) /

+ diff --git "a/102-Python350円277円233円351円230円266円.slides.html" "b/102-Python350円277円233円351円230円266円.slides.html" index 8790379..1213f53 100644 --- "a/102-Python350円277円233円351円230円266円.slides.html" +++ "b/102-Python350円277円233円351円230円266円.slides.html" @@ -15,11 +15,8 @@ - - - - - + + - - - - - - - +