From 829ae567617a0d9f7b0fba3f6c1ed3acef9485e8 Mon Sep 17 00:00:00 2001 From: Dipam Vasani Date: Tue, 22 Oct 2019 23:43:03 -0400 Subject: [PATCH] Add * operator to list unpacking --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 7dd4051..89ffa57 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,16 @@ print(d) 4 ``` +Unpacking lists using the `*` operator. This can be useful to pass the values to a function. + +```python +print(elems) +==> [1, 2, 3, 4] +print(*elems) +==> 1 2 3 4 + +``` + ### 2.2 Slicing We know that we can reverse a list using `[::-1]`.