Skip to main content

Posts

Showing posts from April, 2023

PYTHON ASSIGNMENT 5 AND 6 SOLVED

  PYTHON  ASSIGNMENT – 5 1>What is string concatenation? Explain different ways to concatenate strings. ANS>> String concatenation is the process of combining two or more strings into a single string. In programming, it is a commonly used operation for manipulating text data. There are different ways to concatenate strings depending on the programming language or framework being used. Here are some examples: Using the plus (+) operator: In many programming languages, the simplest way to concatenate strings is by using the plus (+) operator. This is also known as the concatenation operator. Here's an example in Python: string1 = "Hello" string2 = "World" result = string1 + " " + string2 print(result) OUTPUT: Hello World 2.Using the join() method: Another way to concatenate strings is by using the join() method. This method takes an iterable (such as a list or tuple) of strings as an argument and concatenates them with a separator string. Here&#