Skip to main content
It looks like you're using Internet Explorer 11 or older. This website works best with modern browsers such as the latest versions of Chrome, Firefox, Safari, and Edge. If you continue with this browser, you may see unexpected results.

Python for Basic Data Analysis: 1.4 Printing

Get started on your learning journey towards data science using Python. Equip yourself with practical skills in Python programming for the purpose of basic data manipulation and analysis.

The print function

The print function is arguably the most used function in Python. It shows the user vital information about the code on the screen as an output. We have seen how it works in Unit 1.1 when we printed "Hello, World!".

There are many methods of using print. We will introduce 3 in this unit.



We need to pass a parameter/argument* to the function by typing it in the parentheses  ( ) . Here, the parameter/argument is a string data "Hello, World!". More about strings in Unit 1.4.

print("Hello, World!")

*Parameter vs Argument

The terms parameter and argument are usually used interchangeably to refer to information passed to the function. 

Method 1 - Printing a data value

In this method, we are passing a data value - "Hello, World!" - directly to the function.

Method 2 - Assign data to a variable

In this method, we first assign "Hello, World!" into a variable called message. We then pass the variable into the print function. 

Method 3 - Concatenate

This method uses concatenation, which means putting strings together. We use the  +  operator, and we can do this with as many  +  separating different strings within the print function.

Note that when we use  +  to combine the strings together, you may need to insert a space in between the strings. 


Using all 3 methods shown above:

1. Print "Hello, World!".

2. Print "Hello! I am Anna and I am excited to learn Python Programming!" 

Click the triangle button to run the codes and see the output:

Video Guides