print('Hello world!')

# Define two strings
string1 = "Hello, "
string2 = "World!"

# Concatenate strings
concatenated_string = string1 + string2
print("Concatenated String:", concatenated_string)

# Find the length of a string
string_length = len(concatenated_string)
print("Length of the String:", string_length)

# Access characters in a string using indexing
first_char = concatenated_string[0]
last_char = concatenated_string[-1]
print("First Character:", first_char)
print("Last Character:", last_char)

# Slice a string
substring = concatenated_string[7:12]
print("Sliced Substring:", substring)

# Check if a substring is present in the string
if "World" in concatenated_string:
    print("Substring 'World' found in the string")

# Find the index of a substring
index = concatenated_string.find("World")
if index != -1:
    print("Index of 'World' in the string:", index)
else:
    print("Substring 'World' not found in the string")

# Replace a substring
replaced_string = concatenated_string.replace("World", "Python")
print("String after replacement:", replaced_string)

# Convert the string to uppercase and lowercase
uppercase_string = concatenated_string.upper()
lowercase_string = concatenated_string.lower()
print("Uppercase String:", uppercase_string)
print("Lowercase String:", lowercase_string)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: