How to Concatenate a String and a Variable in Python


In this example, we will learn how to uses the + operator to combine a string and a variable in Python.

Source Code

text = 'I love'
print(text + ' Python!')

Output:

I love Python!
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Advertisement