Saturday, 5 May 2018

PROBLEM SOLVING IN PYTHON 1


GLSW4E BOOKS FACEBOOK  W4E INSTAGRAM W4E YOUTUBEW4E HOME
FOLLOW US

Here we answer some python questions, feel free to ask one. 


Question 1:

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 positionSo the next line







• Simply ask python to display all the items from 0 the

 beginning to index position 4.


• Note that if you count from 0 to 4 you should be have 5 items, 

but you have 4  



      



This is because python will not display the item in the last 

index position specified.




Additionally(Using negative index)



   Note that nothing is specified at 
       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: