From 444b6810d3606affdb1bc2138d6c1418c2f45c7d Mon Sep 17 00:00:00 2001 From: Qaiser Abbas Date: Fri, 2 Oct 2020 13:49:31 +0500 Subject: [PATCH] Define a split_in_two function that accepts a list and a number. --- split.py | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 split.py diff --git a/split.py b/split.py new file mode 100644 index 0000000..7d32271 --- /dev/null +++ b/split.py @@ -0,0 +1,5 @@ +def split_in_two(elements, num): + if num%2 == 0: + return elements[2:] + else: + return elements[:2]