...

/

Programs of String Operations

Programs of String Operations

Implement copy, concatenate, search and reverse operations for strings.

Copy a string

In Python, individual characters in a string can be accessed but not assigned or modified.

The following program copies a string to another string:

Press + to interact
Press + to interact
src = 'Just a string' # The string to be copied
lsrc = len(src) # Calculating the length of src
dst = '' # Creating an empty string
for index in range(lsrc):
dst += src[index] # Copying data from src to dst character by character
print (src)
print (dst)

String concatenation

Concatenation means appending a ...