Combining Two String Together In Python


In this blog, I will explain about combining the two strings together in Python. In this blog, I am going to display the combining of the string with the distance.
Software Requirement

Python 3.5.2
Simple Programming
  1. a="C#"  
  2. b="Corner"  
  3. print("Value of A:",a)  
  4. print("Value of B:",b)  
  5. print(a+b)  
  6. print(a+b+" is to learn New technology")  
  7. print("%s %s" %(a,b))  
  8. print("%s %10s" %(a,b))  

In the code, I have typed the A value and B value, followed by having a code as the value of a and value of b. The values of a and b are combined (a+b) and in the condition, I have added another word to print (a+b+" some text").

In the program, I have given the %s, which is used to give the space of the words. If we need 10 spaces to the word, we have to give the %10s and it will take the space.


Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now