free stats

Python Program to Print Text on the Console

Last Update : 08 Oct, 2022 Python, Programming, Example

The best way to learn Python programming is to write programs yourself by practicing examples. The task of this tutorial is to write a program for printing text on the screen.

This is the most basic example any Python developer needs to know. In this simple example, You can display some text on the Python command line interface.

 

Python Program to Print "Hello World!"

Example 01 -:

# print a simple "Hello World!" text on the Python command line.
print('Hello, World!')

This program produces the following result -:

Hello World!

This example uses Python the built-in print() function to print the Hello, World! text on our screen.

 

Python Program to Print User Input on the Screen

Example 02 -:

# Take two values from the user
name = input("Enter Your Name: ")
age = input("Enter Your Age: ")

# Display all values on the screen
print("\n")
print("Your Name : " + name)
print("Your Age :" + age)

This program produces the following result -:

Enter Your Name: UXPython
Enter Your Age: 4

Your Name : UXPython
Your Age :4

This program asks the user to enter their Name and Age. Then, the program will display the Name and Age on the screen.

You found this tutorial / article valuable? Need to show your appreciation? Here are some options:

01. Spread the word! Use following buttons to share this tutorial / article link on your favorite social media sites.

02. Follow us on Twitter, GitHub ,and Facebook.