Learn how to use the print function to show strings and numbers in the screen.

Example 1: Print Text and Numbers

This example will teach you the following:

  1. How to use the print() function in python.

Step 1: Create Project

Create python project or file named main.py.

Step 2: Write Code

Add the following code:

print('The quick brown fox', 'jumps over', 'the lazy dog')
print(300)
print(100 + 200)
print('100 + 200 =', 100 + 200)

Step 3: Run

Run the code by navigating to the project directory:

cd your_project_folder

Then execute:

python main.py

You will get the following:

('The quick brown fox', 'jumps over', 'the lazy dog')
300
300
('100 + 200 =', 300)

Categorized in: