summaryrefslogtreecommitdiffstats
path: root/datatypes.py
diff options
context:
space:
mode:
authorKyle K <kylek389@gmail.com>2020-11-01 19:16:28 -0600
committerKyle K <kylek389@gmail.com>2020-11-01 19:16:28 -0600
commit785380a77801ef60d22d8bfdf97b41f87ef04da7 (patch)
treebb627f1b7fe82f31b4986dc43908bfe1d65fac54 /datatypes.py
parentec3541eff9f56d45d97fdb6d20bda9e1aa0a4795 (diff)
downloadPythonPractice-785380a77801ef60d22d8bfdf97b41f87ef04da7.tar.gz
PythonPractice-785380a77801ef60d22d8bfdf97b41f87ef04da7.tar.bz2
PythonPractice-785380a77801ef60d22d8bfdf97b41f87ef04da7.zip
lambda in python
Diffstat (limited to 'datatypes.py')
-rwxr-xr-xdatatypes.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/datatypes.py b/datatypes.py
index 8072582..5df78f3 100755
--- a/datatypes.py
+++ b/datatypes.py
@@ -31,3 +31,9 @@ print(x)
mysum = sum([i for i in range(1, 10) if i%2==0])
squares = [x**2 for x in range(10)]
squares = list(map(lambda x: x**2, range(10)))
+
+
+# in addition to [] index operator on lists, there's slice operator: [start:stop:step]
+aList = [1, 4, 9, 16, 25]
+slicedList = aList[::-1]
+print(f"reverse of: {aList} is: {slicedList}")