Python String Operations

Concatenation

>>>’Zend’ + ‘Anwar’

Zendanwar

>>>’Zend’ *3

ZendZendZend

Iterating Through String

>> count = 0
>>> for str in ‘Zend Anwar’:
if(str == ‘n’):
count += 1

>>> print(count, “String Found”)
2 String Found

 

Leave a Reply

Your email address will not be published. Required fields are marked *