From 5d58e95a5357f1d34b58a9da2d6443b83e04c58c Mon Sep 17 00:00:00 2001 From: Paul McCarthy <pauldmccarthy@gmail.com> Date: Sun, 22 Mar 2020 20:58:08 +0000 Subject: [PATCH] RF: Previous example works fine with tuples --- talks/virtual_intro/intro.ipynb | 9 ++++----- talks/virtual_intro/intro.md | 3 +-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/talks/virtual_intro/intro.ipynb b/talks/virtual_intro/intro.ipynb index 39d00b1..b64e059 100644 --- a/talks/virtual_intro/intro.ipynb +++ b/talks/virtual_intro/intro.ipynb @@ -123,10 +123,10 @@ "metadata": {}, "outputs": [], "source": [ - "a = [1, 2, 3, 4, 5]\n", + "mylist = [1, 2, 3, 4, 5]\n", "\n", - "for elem in a:\n", - " print(elem)" + "for element in mylist:\n", + " print(element)" ] }, { @@ -428,8 +428,7 @@ "outputs": [], "source": [ "a = [10, 20, 30]\n", - "a = a + [70]\n", - "a += [80]\n", + "a[2] = 999\n", "print(a)" ] }, diff --git a/talks/virtual_intro/intro.md b/talks/virtual_intro/intro.md index 5bfcae0..8d5499a 100644 --- a/talks/virtual_intro/intro.md +++ b/talks/virtual_intro/intro.md @@ -320,8 +320,7 @@ The key difference between lists and tuples is that tuples are *immutable* ``` a = [10, 20, 30] -a = a + [70] -a += [80] +a[2] = 999 print(a) ``` -- GitLab