Python tutorial 25.07.2024
Arokya Naresh
Posted on July 25, 2024
SLICING
we can hop btwn letters in the index
H e l l o m o b i l e
Positive Indexing 0 1 2 3 4 5 6 7 8 9 10
Negative Indexing -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1
Eg1:
msg='HelloMobile'
print(msg[0:11:2]) -->2 denotes hop (i.e no. of hop inbtwn letter )
print(msg[0:11:3])
o/p
Hlooie
Hlol
Iterable-is a container of value which we can iterate by using loop
eg:
loop='Apple'
for d in loop[1:]:
print(d)
A
p
p
l
e
Here loop is that container which has values Apple.To get to know what is in that loop we use for loop which we can iterate
💖 💪 🙅 🚩
Arokya Naresh
Posted on July 25, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.