Skip to main content
Practice

print

---
id: print
title: How to Display Data on the Screen in Python
description: Usage and code examples of the print() function to display data
tags:
- print
- Python
- output
- programming
sidebar_position: 7
isPublic: true
---

# How to Display Data on the Screen in Python

The `print()` function displays the data inside the parentheses `( )` on the screen, just like the English word "print."

<br />

## How to Use It?

Simply enter the data you want to display inside the parentheses!

```python title="Using the print() Function"
print("Python") # Displays the string "Python"

print(123) # Displays the number 123

message = "CodeFriends" # Assigns "CodeFriends" to the variable message
print(message) # Displays the value stored in the variable message

Displaying Multiple Data at Once

You can display multiple items simultaneously using the print function and separating them with commas (,).

Each item separated by a comma is automatically distinguished by a whitespace.

Displaying Multiple Data
name = "CodeFriends"
age = 20

print(name, "is", age, "years old")
# Displays "CodeFriends is 20 years old"

Coding Practice

Enter print(4 / 2) in the practice code editor.

"print(4 / 2)" outputs the result of dividing 4 by 2. In Python, division is done using a forward slash (/), and the result is returned as a floating-point number.

Therefore, the result of 4 / 2 is the floating-point number 2.0 rather than the integer 2.

Want to learn more?

Join CodeFriends Plus membership or enroll in a course to start your journey.