From 828ec629359c01152745130c50bdf80d978ca215 Mon Sep 17 00:00:00 2001 From: Connor Mendenhall Date: Thu, 14 Sep 2017 20:34:40 -0400 Subject: [PATCH 1/2] Update Python Lesson 3 list examples --- python/lesson3/tutorial.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/python/lesson3/tutorial.md b/python/lesson3/tutorial.md index 39544e8a..1fa9bfcb 100644 --- a/python/lesson3/tutorial.md +++ b/python/lesson3/tutorial.md @@ -73,19 +73,25 @@ for a more complete reference: >>> places_to_visit ['Mexico', 'Portugal', 'Kenya', 'Nepal', 'New Zealand'] - + + >>> places_to_visit + ['Mexico', 'Portugal', 'Kenya', 'Nepal', 'New Zealand'] >>> places_to_visit[1] = "Peru" >>> places_to_visit ['Mexico', 'Peru', 'Kenya', 'Nepal', 'New Zealand'] - >>> places_to_visit.pop() - 'Peru' >>> places_to_visit ['Mexico', 'Portugal', 'Kenya', 'Nepal', 'New Zealand'] + >>> places_to_visit.pop() + 'New Zealand' + >>> places_to_visit + ['Mexico', 'Portugal', 'Kenya', 'Nepal'] - >>> places_to_visit.append("Columbia") >>> places_to_visit - ['Mexico', 'Portugal', 'Kenya', 'Nepal', 'New Zealand', 'Columbia'] + ['Mexico', 'Portugal', 'Kenya', 'Nepal', 'New Zealand'] + >>> places_to_visit.append("Colombia") + >>> places_to_visit + ['Mexico', 'Portugal', 'Kenya', 'Nepal', 'New Zealand', 'Colombia'] Try some of these out yourself: From c307a2a7a89dd35128bf8325a7a8fdcdfd09b19d Mon Sep 17 00:00:00 2001 From: Connor Mendenhall Date: Thu, 14 Sep 2017 20:46:23 -0400 Subject: [PATCH 2/2] Always assign new list in examples. --- python/lesson3/tutorial.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/python/lesson3/tutorial.md b/python/lesson3/tutorial.md index 1fa9bfcb..7ed4c292 100644 --- a/python/lesson3/tutorial.md +++ b/python/lesson3/tutorial.md @@ -74,21 +74,18 @@ for a more complete reference: >>> places_to_visit ['Mexico', 'Portugal', 'Kenya', 'Nepal', 'New Zealand'] - >>> places_to_visit - ['Mexico', 'Portugal', 'Kenya', 'Nepal', 'New Zealand'] + >>> places_to_visit = ['Mexico', 'Portugal', 'Kenya', 'Nepal', 'New Zealand'] >>> places_to_visit[1] = "Peru" >>> places_to_visit ['Mexico', 'Peru', 'Kenya', 'Nepal', 'New Zealand'] - >>> places_to_visit - ['Mexico', 'Portugal', 'Kenya', 'Nepal', 'New Zealand'] + >>> places_to_visit = ['Mexico', 'Portugal', 'Kenya', 'Nepal', 'New Zealand'] >>> places_to_visit.pop() 'New Zealand' >>> places_to_visit ['Mexico', 'Portugal', 'Kenya', 'Nepal'] - >>> places_to_visit - ['Mexico', 'Portugal', 'Kenya', 'Nepal', 'New Zealand'] + >>> places_to_visit = ['Mexico', 'Portugal', 'Kenya', 'Nepal', 'New Zealand'] >>> places_to_visit.append("Colombia") >>> places_to_visit ['Mexico', 'Portugal', 'Kenya', 'Nepal', 'New Zealand', 'Colombia']