Save this video free

Python (Fall 2026) Module 8-4: String Slicing

Bill Moseley, Ph.D. - Computer Science Educator · 12:33 · Watch on YouTube

Part of Bakersfield College COMP B10. See all 47 lectures and search them

These notes were made with YouTube Collector. Paste any YouTube link and get the same: a summary, chapters and a searchable transcript.

Overview

Bill Moseley explains how Python strings can be processed as iterables and sliced using index-based notation. He demonstrates cleaning noisy text by retaining letters and spaces in a reusable function, then covers zero-based indexing, stop-exclusive slices, negative indices, omitted bounds, step sizes, and reversing a string with `[::-1]`.

Key takeaways

Chapters

0:00 Clean Noisy Text by Iterating Through Python Strings
7:31 Use String Indexes and Stop-Exclusive Slices
9:36 Slice to the End, Skip Characters, and Reverse Strings

Keep these chapters and the full searchable transcript in your own library.

Transcript excerpt

0:00 I'm going to give you a few more tools, maybe  more than five crayons. Maybe I'll give you the box of 16. So, strings are iterables. What's,  what does that mean? Strings are basically just a list of characters that you can go through one  at a time. But that gives us a lot of power, right? Look at this code. So, we have  this text. Bakersfield College is in there somewhere. You can see that. But there's  also a lot of garbage. This is really common. Okay. When you're dealing with text and data from  the real, real world, expecting it to be clean and usable is ridiculous and will lead to failure 100%  of the time. If you're working with real data, right, you're going to get all kinds of garbage  in there because users enter garbage. If we

0:50 have sensors that are collecting data from the  environment, they're getting false positives. If I set up a microphone that was supposed to capture  bird sounds on campus and turn that into data, what do you suspect it would also capture, right?  People yelling, like the bells that toll every hour, cars driving by, airplanes, you're getting  all kinds of garbage data, but that's, that's how it always is. So when you have text data, this  is a really common scenario. What do you want to keep? You want to keep Bakersfield College. How  do you know the difference? Well, we know that Bakersfield College doesn't contain punctuation.  So, anything that's not a letter, I can get rid of it. So, what do I do? I'm going to go through  this one character at a time. And I'm just going to say, is that a letter? Is that a letter?  Is that a letter? And if the answer is yes,

This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.

In this course

Related notes

Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Bill Moseley, Ph.D. - Computer Science Educator.

Want the full transcript?

Save this video in YouTube Collector to get its complete searchable transcript, your own AI summaries, and a library that keeps every video you collect in one place.