30-Day Coding Challenge

Days 14 & 15 — I’m Still Coding!

Kester R.
DSV Logs!
Published in
2 min readJul 21, 2024

--

Photo by Author Via Microsoft Designer & Canva

It’s been 2 days since my last report. They sure passed by quickly, almost as if time was racing to the end.

Anyway, while my schedule is still as busy as ever with very little time for my challenge, I have to acknowledge one fact:

I’M STILL CODING.

So, before I prepare to write my report for Days 16 and 17, here’s my top highlight for Days 14 & 15 to fill in the blank pages.

And what is that highlight? Slicing!

A beneficial process for extracting parts of strings, lists, and tuples. It’s like a combination of indexing and range if that makes any sense.

numbers = [1, 2, 3, 4, 5]
slicing = numbers[1:4]

#OUTPUT: [2, 3, 4]

And the best part of slicing? The third parameter — “STEP”

It determines the increment between each element of the slice or how many elements to skip.

If the step is a positive number, the slice is taken from left to right. If the step is negative, the slice is taken from right to left, as seen in the following code:

numbers = [1, 2, 3, 4, 5]
slicing = numbers[4:1:-1]

#OUTPUT: [5, 4, 3]

Useful, right?

Once again, my reports will go live every two days due to my current schedule.

Thanks for reading and staying updated with my challenge…

--

--

Kester R.
DSV Logs!

I'm a writer trying to do what he knows best - "hitting the keys on my keyboard"