diff --git a/pythonintro/Classes.ipynb b/pythonintro/Classes.ipynb index 6500478008b3a84c0caaadade2459b1837b6259a..dcd8647c71f0fb46694dfd4b69d885bf2db55b87 100644 --- a/pythonintro/Classes.ipynb +++ b/pythonintro/Classes.ipynb @@ -42,7 +42,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -69,7 +69,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -362,7 +362,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.6" + "version": "3.10.12" }, "orig_nbformat": 4, "vscode": { diff --git a/pythonintro/Classes_Inheritance.ipynb b/pythonintro/Classes_Inheritance.ipynb index f7d0a9cd8768530e8fed133c5e45313cfff4f4c3..502a5326d87e06c5354a0f568a34fbd41f4ec886 100644 --- a/pythonintro/Classes_Inheritance.ipynb +++ b/pythonintro/Classes_Inheritance.ipynb @@ -150,7 +150,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.6" + "version": "3.10.12" }, "orig_nbformat": 4, "vscode": { diff --git a/pythonintro/Classes_PrivateVariables.ipynb b/pythonintro/Classes_PrivateVariables.ipynb index ef6439def102bbb76d66b37d2f81aa0f6967aba2..68dcc4ee9407afdb7a7a7d5bad312efdef0bda59 100644 --- a/pythonintro/Classes_PrivateVariables.ipynb +++ b/pythonintro/Classes_PrivateVariables.ipynb @@ -169,7 +169,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.6" + "version": "3.10.12" }, "orig_nbformat": 4, "vscode": { diff --git a/pythonintro/Functions.ipynb b/pythonintro/Functions.ipynb index 85deb0a4404aa8a0a37186d02936990db77faac6..b3a0df79775dc0ded6f21557692713274a21437e 100644 --- a/pythonintro/Functions.ipynb +++ b/pythonintro/Functions.ipynb @@ -84,23 +84,25 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "The sum is: 7.1\n" + "<class 'int'> <class 'int'>\n", + "The sum is: 7 3 4\n" ] } ], "source": [ "def my_sum(x, y):\n", - " return x + y\n", + " print(type(x), type(y))\n", + " return x +y, x, y \n", "\n", - "sum = my_sum(3,4)\n", - "print('The sum is: {}'.format(sum))" + "sum, a ,b = my_sum(3,4)\n", + "print('The sum is: {} {} {}'.format(sum,a,b))" ] }, { @@ -505,13 +507,16 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ + "the Fibonacci number is: -3\n", + "the Fibonacci number is: -2\n", + "the Fibonacci number is: -1\n", "the Fibonacci number is: 0\n", "the Fibonacci number is: 1\n", "the Fibonacci number is: 1\n", @@ -528,7 +533,7 @@ "source": [ "Fibonacci = lambda n: n if n <= 1 else Fibonacci(n-1) + Fibonacci(n-2)\n", "\n", - "for i in range(0,10):\n", + "for i in range(-3,10):\n", " fib = Fibonacci(i)\n", " print('the Fibonacci number is: {}'.format(fib))\n" ] @@ -550,7 +555,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.6" + "version": "3.10.12" }, "orig_nbformat": 4, "vscode": { diff --git a/pythonintro/solutions/Solution_AccountClass.ipynb b/pythonintro/solutions/Solution_AccountClass.ipynb index 2849ad16455865d10214f0d3e8bdc7071b962d70..47fe7ea94a7204694fe854aca1723c3dd2059807 100644 --- a/pythonintro/solutions/Solution_AccountClass.ipynb +++ b/pythonintro/solutions/Solution_AccountClass.ipynb @@ -42,6 +42,7 @@ "class Account():\n", " def __init__(self, name, balance = 0):\n", " self._name = name\n", + " # what can we improve in the following line?\n", " self._balance = int(balance)\n", " if self._balance < 0:\n", " self._balance = 0\n",