#7 Slicing And Other Functions In Python | Python Tutorials For Absolute Beginners.
Skills:
Python for Data80%
Key Takeaways
Teaches string slicing and other functions in Python for absolute beginners
Full Transcript
hello everyone welcome back to my channel code for kids so in our previous session we did the project for like how what is string right now in this video we are going to learn about the string slicing so what do you mean by slicing okay so if you want apple slice or banana slice or any slice it means we have to cut that right so in python also we have some string slicing so now strain means so we can say string is nothing but your sequence of characters that is words that is statement right so by using a slicing we can return a range of characters by using the slice syntax okay so here we have to specify what is start index and what is the end index separated by a colon okay so this is our slicing so now we will see with the help of example okay so how we will start this so first we have to take one var gamer suppose my variable name is a here so i told you in our previous video also like uh you can use your single code or double code for the string this is based on your choice so now i want to write hello world so as you can see here we have a hello world even if i will print only a so what will happen if you will read this you will get hello world okay but instead of hello world if you want a particular character so how you will get that so this is called as the string slicing okay so we need to just write print here after that in the round bracket we will take our variable so what is the variable variable is a here then we have to just provide the index suppose i want 2 to 5 so you have to give your starting index so what is the starting index here that is 2 what is my ending index that is 5 okay so index means what so if you will run this program so in the computer what will happen it will create one mainly it will allocate the memory for you suppose this is memory structure so here it will store like this h is here e is here again we have a l after that we have one more l then o then it will create one space for the one name the address for your space then the blue so in a python always you have to remember the word always okay so in python always the index number will start from zero so as you can see in the h we have a zero in the e we have one here we have two then we have a three then we have a four like that okay so what will happen now if i will run this so now can you just imagine what you will get output so let's run so you will get ll oh how big is as you can see h e l so 0 1 2 so in the one for a 2 position you have l so you will get l so we have to continue till 5 okay so you will get ll o but if you will take this index as you can see 0 1 2 3 4 but this is 4 why here we don't have a space so in the python if you will start from your starting index you will get that but always the ending index is like minus 1 it means you have to just take suppose internally that will convert 5 minus 1 you will get 4 so here we have to continue the index number 2 to 4 so you will get llo what happen if i will take 7 here so now just imagine what you will get you can stop the video you can write your output in the comment section okay see what you will get you will get ll o w how because here see we have 0 1 2 3 4 space is 5 w is 6 0 is 7 but in the python what is the rule you will get minus 1 so you will get 2 to 6 only so this is our first letter you have to just give your static index and you have to just give your ending index okay now we will see the next again suppose i have hello world so you need to just take hello world the hello world is the famous word for our program okay so see equals to hello world now what i want to print here here we will take our variable so here i will not give any starting index directly i will give the ending index like i want to print the 5 it means it will bring till 4. so what will happen now can you just imagine what will happen what output you will get you will get h-e-l-l-o it means if you will not give any starting index so by default it will start from your zeroth position so here we have h then we have e l o okay now we will see the next one so what is our next one ebay you can give your ending indexes so like suppose a equals to hello world after that you want to just print this so print but you will take now print a here i want to give the index number like only two colon it means it will start from your index number from two till end one okay so now if i will run you will get so l is our sec third index number but here uh we will take 0 1 2 till last one so this is of starting and ending here by default it will start from first number and here by default it will take the number which is last one okay so in this way we can provide the starting index and the ending index even we can take our negative index also so how we will do that again we need to just take hello world after that we have to just print this how we will pray we have to write print after that what is our variable that is a here i want to give the ending like a negative index negative means it will start from reverse now see what you will get here you will get w o r 5 because c minus 5 means what it will start from here legacy minus 1 three four five you will get minus five colon till minus two so one two okay you will get w o so in this way we can perform our string slicing okay so thank you so much for watching this video please like share and subscribe our channel which is code for kids and press the bell icon if you want more latest updates so thank you so much
Original Description
In this video, you will learn how to use a string in Python and how to declare a string in Python.
A string is a sequence of characters, and it can be created by enclosing characters inside a single quote and double quotes. You can also use triple strings to represent multiline strings.
You will know how to get indexing as the concept is explained with the help of a string indexing table.
The complete procedure is explained in a practical way so you can understand the concept of strings easily. This video will solve your queries like what is string indexing and what is string slicing.
We have a dedicated playlist for the Python playlist. You can watch more videos from there to learn in-depth about it.
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Code For Kids · Code For Kids · 42 of 60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
▶
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#Scratch Tutorial 1 | How to create your own Scratch account #codeforkids #scratch #Game Development
Code For Kids
#Scratch Tutorial 2 ||How to enable Share Button option in Scratch #codeforkids #scratch #game
Code For Kids
Fish Moving inside an Ocean 🌊🌊 #codeforkids #scratch 🥰
Code For Kids
Scratch Programming | Fish Aquarium game | #codeforkids #scratch #game
Code For Kids
Draw the circle in scratch#codeforkids #scratch #game
Code For Kids
Draw Circles in Scratch || How do you draw shapes on Scratch? #codeforkids #scratch #game #coding
Code For Kids
How to Make a Dino Jump Game in Scratch | Tutorial #codeforkids #scratch #game
Code For Kids
Scratch Tutorial || How to Make a Catch Game in Scratch.|| Scratch Tutorial for absolute beginer
Code For Kids
Scratch Tutorial || Day 1
Code For Kids
Scratch Tutorial || Day 2 (DJ System , Dance and Story writing)
Code For Kids
How to Make A Maze Game in Scratch 3.0 | Scratch 3.0 Tutorial |Scratch Tutorial for begineer
Code For Kids
Scratch Tutorial || Day 3
Code For Kids
Scratch Tutorial || Day 4
Code For Kids
Scratch Tutorial | Cat And Mouse Game | Scratch Tutorial for Beginner
Code For Kids
Scratch Tutorial || Day 5
Code For Kids
how to make dress up game on scratch || Scratch Tutorial for Beginner
Code For Kids
How to Make a Pong Game in Scratch || Scratch Tutorial for Beginner
Code For Kids
Scratch Tutorial || Day 6(part 1)
Code For Kids
Scratch Tutorial || Day 6( Part 2)
Code For Kids
Scratch Tutorial || Day 7
Code For Kids
Scratch Tutorial || Day 8
Code For Kids
How to Make Piano Game || Learn to Use Music Extension || Scratch Tutorial || Day 8
Code For Kids
How to Make Piano Game || Learn to Use Music Extension ||Scratch Tutorial for beginner
Code For Kids
Scratch Tutorial || Day 9
Code For Kids
Scratch Tutorial || Draw Shapes #shorts #codeforkids #youtubeshorts
Code For Kids
Scratch Tutorial |How to Draw Shapes in Scratch #scratch #scratchtutorials #codeforkids
Code For Kids
Day 10|| Scratch Tutorial
Code For Kids
Scratch Tutorial || Archery Tutorial
Code For Kids
#1 || Thunkable Beginner Tutorial Platform Overview
Code For Kids
App Development ||Tutorial 2 || how to add button in Thunkable || Thunkable for beginner #codeforkid
Code For Kids
App Development || Tutorial 3|| Beginner Tip "Change screens with a button click" in Thunkable
Code For Kids
Scratch Tutorial ||
Code For Kids
Thunkable Tutorial || Using Camera and Image Recognition components with Thunkable
Code For Kids
Build a Translator App with Thunkable ||Thunkable App Development || Tutorial 5||
Code For Kids
Thunkable Beginner Tutorial #6 || Web Viewer|| Redirecting App
Code For Kids
#1 World in Python || Python Tutorial || Python Programming || Google Colab
Code For Kids
#2 Python Tutorial for Beginners | User input in Python | Command Line Input | Python Variable
Code For Kids
#3 Python Comments | How To Write Comments In Python | Python Tutorial For Beginners |
Code For Kids
#4 Python Tutorial for Beginners | Data Types in Python
Code For Kids
#5 Numbers & Typecasting in python | Python Tutorial
Code For Kids
#6 Strings Tutorial | How To Use Strings In Python | Python Tutorial | Python Training |
Code For Kids
#7 Slicing And Other Functions In Python | Python Tutorials For Absolute Beginners.
Code For Kids
#8 Boolean in Python | Python Tutorial for Begniner
Code For Kids
#9 Python Tutorial for Beginners | Operators in Python
Code For Kids
#10 Lists And List Functions | Python Tutorials For Absolute Beginners
Code For Kids
#11 Tuple in Python | Python Tutorial
Code For Kids
#12 In Python | Python Sets Tutorial | Python Tutorial for Beginners | #python #pythonprogramming
Code For Kids
#13 If Elif Else Statement in Python || Python Tutorial for Beginners |
Code For Kids
#14 While Loop in Python ||Python Tutorial for Beginners
Code For Kids
Python Tutorial for addition of 2 numbers #shorts #youtubeshorts #codeforkids #pythonprogramming
Code For Kids
Python Tutorial for absolute Beginner|| While loop #pythonprogramming #shorts #youtubeshorts
Code For Kids
Machine learning for the kids with Scratch || Machine Learning for kids ||Day 1
Code For Kids
# Tutorial 1 || Machine Learning for kids | Image Classification example | Girl and boy
Code For Kids
#15 For loop in Python || Python Tutorial for Beginner
Code For Kids
# Tutorial 2 || Machine Learning for kids | Smart Home Automation | Turn On the Fan
Code For Kids
#Tutorial 3 || Snapchat Filter in Machine Learning|| Machine Learning for the kids ||
Code For Kids
#Tutorial 4 || Image Identification || Machine Learning for the kids|| Tiger , Elephant, boy
Code For Kids
Scratch Tutorial || Apple Catcher Game || Fruit Catcher|| catch game in Scratch
Code For Kids
Scratch Tutorial || How to record audio in Scratch || Scratch Tutorial for beginner ||
Code For Kids
Scratch Tutorial || how to translate language in scratch || Scratch tutorial for beginner
Code For Kids
More on: Python for Data
View skill →Related Reads
📰
📰
📰
📰
AI is reducing quality
Dev.to AI
The Shift From Prompting to Building: How Beginners Are Creating Real Apps Without Writing Code
Medium · AI
Video Clipper: An Open-Source Video Processing Tool with Python, PySide6, and FFmpeg
Dev.to · Developer zouraiz
10 Free AI Tools That Feel Like Magic in 2026
Medium · AI
🎓
Tutor Explanation
DeepCamp AI