Mathematical Operators

Mathematical Operators

In python, we can apply the following mathematical operators for Strings.

  1. + operator for concatenation
  2. * operator for repetition
print("Wayto"+"easylearn") ==> Waytoeasylearn 
print("Waytoeasylearn"*2) ==> WaytoeasylearnWaytoeasylearn

Note

  1. To use + operator for Strings, compulsory both arguments should be str type.
  2. 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
Scroll to top