January 2019
Beginner
318 pages
8h 23m
English
The following table shows string's special operators. Consider a is Hello and b is World:
|
Operator |
Description |
Example |
|
+ |
Concatenation: adds values on either side of the operator |
a + b will give HelloWorld |
|
[] |
Slice: gives the character from the given index |
a[7] will give r |
|
[ : ] |
Range slice: gives the characters from the given range |
a[1:4] will give ell |
|
* |
Repetition: creates new strings, concatenating multiple copies of the same string |
a*2 will give HelloHello |
|
not in |
Membership: returns true if a character does not exist in the given string |
Z not in a will give 1 |
|
in |
Membership: returns true if a character exists in the given string |
H in a will give 1 |
|
% |
Read now
Unlock full access