How to print a string variable in Python?

To print a string variable, you can use the print function. Here is an example code for printing a string variable:

name = "Alice"
print(name)

The output will be:

Alice

In this example, the variable ‘name’ stores the string “Alice,” and then we used the print function to output the value of this variable.

bannerAds