Concatenation
Great! Now you know how to store text in a variable. Now let's consider how we can operate with such variables.
First, let's consider the concatenation. This operation simply connects two strings into one. To concatenate two strings in Python, use the +
operator (like in number addition).
Note that concatenation will not make additional blank spaces between addends.
For example, we can 'connect' words with the article.
123456# Article and word article = "The" country = "Netherlands" # Output result of the concatenations print(article + country) print(article + " " + country) # Add blank space between
Thanks for your feedback!
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 4
Concatenation
Swipe to show menu
Great! Now you know how to store text in a variable. Now let's consider how we can operate with such variables.
First, let's consider the concatenation. This operation simply connects two strings into one. To concatenate two strings in Python, use the +
operator (like in number addition).
Note that concatenation will not make additional blank spaces between addends.
For example, we can 'connect' words with the article.
123456# Article and word article = "The" country = "Netherlands" # Output result of the concatenations print(article + country) print(article + " " + country) # Add blank space between
Thanks for your feedback!