strings
strings
You can access the characters one at a time with the bracket
operator
str[0]='P'=str[-6],
str[1]='Y' = str[-5],
str[2] = 'T' = str[-4],
str[3] = 'H' = str[-3],
str[4] = 'O' = str[-2],
str[5] = 'N' = str[-1].
• 'str' object does not support item assignment
[] Slice - Gives the character from the given index a[1] will give e
[:] Range Slice - Gives the characters from the given a[1:4] will give ell
range
in Membership - Returns true if a character exists in H in a will give True
the given string
not in Membership - Returns true if a character does not H not in a will give False
exist in the given string
1
0
welcome
hELLO pYTHON
this is string
Thanks