diff --git a/Chapter_04/4-10_slices.py b/Chapter_04/4-10_slices.py new file mode 100644 index 0000000..ea1f9e5 --- /dev/null +++ b/Chapter_04/4-10_slices.py @@ -0,0 +1,13 @@ +# Excercise 4-10 Slices +# Learning Objective: Slice list for First, Middle, and Last 3 elements of a list respectively. + +numbers = [value for value in range(1, 21)] +print(str(numbers) + "\n") + +print(f"The first three items in the list are: {numbers[0:3]}\n") +print(f"Three items from the middle of the list are: {numbers[9:12]}\n") +print(f"The last three items in the list are: {numbers[-3:]}") + +# 100% this can be done better. + +