Python Practice › String Programs › Program 29

Combine two strings

EasyString Programs · 29 of 106

Write a Python program to combine two strings into one.

Advertisement
Input
"abc", "def"
Output
abcdef abcdef abcdef

Approach

  1. Use +.

Solution

Python
a, b = "abc", "def"print(a + b, f"{a}{b}", "".join([a, b]))
Output
abcdef abcdef abcdef
Advertisement

Learn the concept

New to this topic? Read the lesson, then come back.

More string programs

← All 106 String Programs