Python Program to Print String

« Previous Program Next Program »

Print String in Python

To print string in python, you have to ask from user to enter a string and print it back on the output screen using the print() statement as shown in the program given below.

Python Programming Code to Print String

Following python program ask from the user to enter the string to print that string as output of the program:

# Python Program - Print String

print("Enter 'x' for exit.");
string = input("Enter string: ");
if string == 'x':
    print("\nYou entered:",string);

Here is the sample run of the above python program to illustrates how to print string:

print string python

Now enter any string say i love to program on codescracker and press enter key to see what was the string that you have entered in this program as shown here:

printing string program python

Here is the same program on python shell:

python print string

Same Program in Other Languages

You may also like to learn or practice the same program in other popular programming languages:

« Previous Program Next Program »


Quick Links
Signup - Login - Give Online Test