concatenation:

  • In python, concatenation is defined as "the process of combining or joining or merging one string with the other string".
  •  It uses the plus operator for combining the strings.
  • The string must be enclosed with single quotations or double.
  • Type conversion is needed.
  • We can combine an integer value with a string by using the str(int) function.
  • The plus(+) operator is used to combine the string at the end of the string.
  • The % string format operator is used to combine the string anywhere we want.
Syntax: str1+str2

#write a python program to demonstrate concatenation function.

  1. a="python"
  2. b="programming"
  3. x=a+b
  4. print(x)
  5. str1="python"
  6. str2=str(3.0)
  7. str=str1+str2
  8. print(str)
Output: pythonprogramming
              python3.0



Instance Of Java

We will help you in learning.Please leave your comments and suggestions in comment section. if you any doubts please use search box provided right side. Search there for answers thank you.
«
Next
Newer Post
»
Previous
Older Post

No comments

Leave a Reply

Select Menu