How to Assign a String to a Variable in Python


In this example, we will learn how to assign a string to a variable in Python.

Source Code

# the variable name followed by an equal sign and the string
var1 = 'Python'
print(var1)

Output:

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