This content originally appeared on DEV Community and was authored by Arokya Naresh
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
This content originally appeared on DEV Community and was authored by Arokya Naresh
Arokya Naresh | Sciencx (2024-07-25T11:54:43+00:00) Python tutorial 25.07.2024. Retrieved from https://www.scien.cx/2024/07/25/python-tutorial-25-07-2024/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.