What are range operators?
Answer:
Range operators (?)
Are simple operators that help us in slicing data to get a specific portion from the data.
Learn python programming language here
Example:
The first item T is stored at index 0 in the computer memory location where the item strings is stored. The second element is in index 1 etc.
So to get an item, you must know the item location (index number) or at least the item label
(Which can be used to get the item index position) So the next line
• Simply ask python to display all the items from 0 the
beginning to index position 4.
beginning to index position 4.
This is because python will not display the item in the last
index position specified.
index position specified.
the beginning
This means start from the beginning, stop at -1 index
(which is supposed to be the last item on the string by the right side),
******But the print statement will return all the element except the last one.
- So to get all the element simply say
- And to get the reverse then do:
No comments:
Post a Comment