Mathematical Operators
In python, we can apply the following mathematical operators for Strings.
- + operator for concatenation
- * operator for repetition
print("Wayto"+"easylearn") ==> Waytoeasylearn print("Waytoeasylearn"*2) ==> WaytoeasylearnWaytoeasylearn
Note
- To use + operator for Strings, compulsory both arguments should be str type.
- To use * operator for Strings, compulsory one argument should be str and other argument should be int.
len() in-built Function
We can use len() function to find the number of characters present in the string.
E.g
s = 'Waytoeasylearn' print(len(s)) ==> 14
Mathematical Operators