Python : Basic code : 03

1) Now we will see string let us know some point which are needed to understand “hello friends” in string h takes value 0…. counting starts from 0 0,1,2,3,4,5,6,7,8,9,10,11,12,13 total 13 space also have value
“hello friends” in negative order s takes value -1 and h takes value -14 counting starts from -1 “hello friends” -14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1
2) This type of case eg) 0:5 0 is including and 5 is excluding [in:ex]
3) Now see this slicing


nothing means 0
4) when in:ex is empty [including empty it takes 0 and excluding empty it takes length]

5) A:B:C this is extended slicing In this case first it will same as A:B and C will skip the character and its value is 1. so when it will empty value is 1and will print whole . when it is 2 it will skip 1 character when it is 3 it will skip 2 character

6) For negative in:ex so -4 means i and -2 exclude e,l will not print

7) lets see for negative same as earlier -2 means it will skip 2 character from end to first for -1 all will invert


8) To find length

Thankyou guy’s see you in next article #have fun #happy coding #have fun 🙂
1 Response
[…] reverse same as we see earlier in . If you don’t know about the slicing then read the article https://knowledge-junction.com/2021/10/03/python-basic-code-03/ then also have a doubt then comment . I will try my level to […]
You must log in to post a comment.