Python Tutorial: Slicing Lists and Strings

Share this & earn $10
Corey Schafer
Published at : 17 Oct 2021
270743 views
5123
33

In this video we will look at how to slice lists and strings in Python. Slicing allows us to extract certain elements from these lists and strings. This can be extremely useful for stripping out certain values from lists or getting a substring of a characters from a string. Let’s take a look at a few code examples.

The code from this video can be found at:
https://github.com/CoreyMSchafer/code_snippets/tree/master/Slicing


✅ Support My Channel Through Patreon:
https://www.patreon.com/coreyms

✅ Become a Channel Member:
https://www.youtube.com/channel/UCCezIgC97PvUuR4_gbFUs5g/join

✅ One-Time Contribution Through PayPal:
https://goo.gl/649HFY

✅ Cryptocurrency Donations:
Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot

✅ Corey’s Public Amazon Wishlist
http://a.co/inIyro1

✅ Equipment I Use and Books I Recommend:
https://www.amazon.com/shop/coreyschafer

▶️ You Can Find Me On:
My Website - http://coreyms.com/
My Second Channel - https://www.youtube.com/c/coreymschafer
Facebook - https://www.facebook.com/CoreyMSchafer
Twitter - https://twitter.com/CoreyMSchafer
Instagram - https://www.instagram.com/coreymschafer/

#Python

Python (Programming Language)Array SlicingList

Resources: Welcome to the Neighborhood - Crash Course Kids #2.1

Resources: Welcome to the Neighborhood - Crash Course Kids #2.1

MLP Fanfiction Reading - Their Very Own Suns - Chapter 1

MLP Fanfiction Reading - Their Very Own Suns - Chapter 1

You Can't Always Get What You Want w/ Tedeschi Trucks Band (Live in Birmingham)

You Can't Always Get What You Want w/ Tedeschi Trucks Band (Live in Birmingham)

Troye Sivan - YOUTH (Official Video)

Troye Sivan - YOUTH (Official Video)

Ace on Haven with that Prime Phantom | Asuna

Ace on Haven with that Prime Phantom | Asuna

"BEST CHROME STEEL CHARACTER?" - Chrome Steel Dom Gameplay - Gears 5

"BEST CHROME STEEL CHARACTER?" - Chrome Steel Dom Gameplay - Gears 5

Stereochemistry - A Simple Trick for Determining R and S

Stereochemistry - A Simple Trick for Determining R and S

TWEETS THAT MADE AUGUST TERRIBLE

TWEETS THAT MADE AUGUST TERRIBLE

"Despite the increasing number of women graduating from law..." GMAT Sentence Correction Explained!

"Despite the increasing number of women graduating from law..." GMAT Sentence Correction Explained!

Everything We Need

Everything We Need

Let's Learn English at the Shopping Mall | English Video with Subtitles

Let's Learn English at the Shopping Mall | English Video with Subtitles

YOUR TIME IS LIMITED | Steve Jobs | "Don't waste your life living someone else's"

YOUR TIME IS LIMITED | Steve Jobs | "Don't waste your life living someone else's"

Shouse - Love Tonight (Restricted & Nik Sitz Edit)

Shouse - Love Tonight (Restricted & Nik Sitz Edit)

15 UNFAIR ADVANTAGES Attractive People Have

15 UNFAIR ADVANTAGES Attractive People Have

WITHIN REACH

WITHIN REACH

Transformation Mastery Masterclass: How To Let Go (Letting Go Technique Explained)

Transformation Mastery Masterclass: How To Let Go (Letting Go Technique Explained)

We Are Only Here For a Short while (Original song)

We Are Only Here For a Short while (Original song)

Different types of Drivers

Different types of Drivers

"The Preferred Airparts Story"

"The Preferred Airparts Story"

What is the Inquisitive channel all about?

What is the Inquisitive channel all about?

Astrid S - Good Choices (#GoodChoicesVideo)

Astrid S - Good Choices (#GoodChoicesVideo)

Get SharePoint Site Owners using PowerShell (Office 365 Group Connected Site)

Get SharePoint Site Owners using PowerShell (Office 365 Group Connected Site)

LAVATORY  SERVICES Airbus A320 !

LAVATORY SERVICES Airbus A320 !

Faith No More - Easy (Official Music Video)

Faith No More - Easy (Official Music Video)

The Power to Resist - Dragon Ball Super | Norihito Sumitomo

The Power to Resist - Dragon Ball Super | Norihito Sumitomo

EasyAccess - monteringsvideo: EasyCode Touch & EasyFinger Touch

EasyAccess - monteringsvideo: EasyCode Touch & EasyFinger Touch

AZU Dog Food now available in JM Poultry!

AZU Dog Food now available in JM Poultry!

Alan Walker & Ava Max - Alone, Pt. II

Alan Walker & Ava Max - Alone, Pt. II

Bilge Nihan feat. Bahadır Tatlıöz - Net (Vay Haline)

Bilge Nihan feat. Bahadır Tatlıöz - Net (Vay Haline)

Nessy Spelling Strategy | Homophones | Learn to Spell

Nessy Spelling Strategy | Homophones | Learn to Spell

Once you are done with the #narcissist - you have to stop 🛑 doing this!

Once you are done with the #narcissist - you have to stop 🛑 doing this!

Don Toliver - No Idea [Official Music Video]

Don Toliver - No Idea [Official Music Video]

Gracie Abrams - Feels Like (Official Audio)

Gracie Abrams - Feels Like (Official Audio)

Of Peers

Of Peers

You'll Want To Buy EVERYTHING In This Video 2

You'll Want To Buy EVERYTHING In This Video 2

Phil Wickham - Great Things (Official Lyric Video)

Phil Wickham - Great Things (Official Lyric Video)

Nasser and Shane Watson look ahead to England and Australia's T20 World Cup clash! 👀

Nasser and Shane Watson look ahead to England and Australia's T20 World Cup clash! 👀

Ballpoint - Things to Do

Ballpoint - Things to Do

What is Popular Culture?

What is Popular Culture?

Toto - Love Isn't Always On Time (Hold the Line) (HD)

Toto - Love Isn't Always On Time (Hold the Line) (HD)

Fortnite Build Up Emote 1 Hour Version! (ICON SERIES)

Fortnite Build Up Emote 1 Hour Version! (ICON SERIES)

A, AN, THE - Articles in English

A, AN, THE - Articles in English

NOAH BECK REACTS TO GRIFFIN JOHNSON'S DISS TRACK!!

NOAH BECK REACTS TO GRIFFIN JOHNSON'S DISS TRACK!!

Photographer Creates Macro Videos Of Objects Breaking

Photographer Creates Macro Videos Of Objects Breaking

Travelers

Travelers

It's Time To Admit Something About Call of Duty

It's Time To Admit Something About Call of Duty

TOOL - The Grudge (Audio)

TOOL - The Grudge (Audio)

SovietWomble Stream [16.01.2021] Rust

SovietWomble Stream [16.01.2021] Rust

Most Unique Homes On Earth!

Most Unique Homes On Earth!