From 660b814195c88c1b81d785bdeb181a64d44b2d46 Mon Sep 17 00:00:00 2001 From: kjg Date: Fri, 29 May 2020 22:11:07 +0900 Subject: [PATCH] [Python #6] create e34.py --- kjg/python-the-hard-way/e34.py | 18 ++++++++++++++++++ kjg/python.org | 2 ++ 2 files changed, 20 insertions(+) create mode 100644 kjg/python-the-hard-way/e34.py diff --git a/kjg/python-the-hard-way/e34.py b/kjg/python-the-hard-way/e34.py new file mode 100644 index 0000000..d509907 --- /dev/null +++ b/kjg/python-the-hard-way/e34.py @@ -0,0 +1,18 @@ +animals = ['bear', 'python3.6', 'peacock', 'kangaroo', 'whale', 'platypus'] + +#1. The animal at 1. +print(animals[1]) +#2. The third (3rd) animal. +print(animals[2]) +#3. The first (1st) animal. +print(animals[0]) +#4. The animal at 3. +print(animals[3]) +#5. The fifth (5th) animal. +print(animals[4]) +#6. The animal at 2. +print(animals[2]) +#7. The sixth (6th) animal. +print(animals[5]) +#8. The animal at 4. +print(animals[4]) diff --git a/kjg/python.org b/kjg/python.org index 61efb6a..10a174a 100644 --- a/kjg/python.org +++ b/kjg/python.org @@ -126,3 +126,5 @@ How to use if, elif How to use for-loop **** ex33 How to use while-loop +**** ex34 +How to use Accessing Elements of Lists