You can make use of the + operator in Python to concatenate one string with another.
Program 1:
# Python Program to concatenate two strings
one_string = "hello ";
another_string = "world!"
concatinated_string = one_string + another_string
print(concatinated_string)
Output:
This may be a possible solution if you have a few strings to concatenate, what if you have a long list of string values to concatenate, in such scenarios you can make use of a join() method from the string class.
Program 2:
countries = ["USA", "Canada", "Mexico", "Germany", "Australia"]
countries_str = ', '.join(countries)
print(countries_str)
Output:
Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!