Advertisement
Jamesbusayo

Untitled

Feb 22nd, 2020
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. def split_in_two(values, number):
  2.     if number % 2 == 0:
  3.         return values[2:]
  4.     else:
  5.         return values[0:2]
  6.  
  7. values = ["a", "b", "c", "d", "e", "f"]
  8. print(split_in_two(values, 3))
  9. print(split_in_two(values, 4))
  10. print(split_in_two(values, 1))
  11. print(split_in_two(values, 10))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement