Python Strings

String Operations

1. String Concatenation

You can concatenate (join) two or more strings using the + operator.

first_name = "Vasanta"
last_name = "Kumar"
full_name = first_name + " " + last_name
print(full_name)

Output:

Vasanta Kumar

Here, the + operator concatenates first_name and last_name with a space in between to form full_name.

2. String Repetition

The * operator allows you to repeat a string multiple times.

name = "Praveen"
repeat_name = name * 3
print(repeat_name)

Output:

PraveenPraveenPraveen

The string Praveen is repeated 3 times.