Output Data

In programming languages, you will use some programming word when you would like to display a message.

  • In Python that word is print. The easiest way we can output data in Python is using print function.
  • Print is a function and that’s why we will be using parenthesis ( ) with print. Functions are explained in another lesson.
  • Usually the value we would like to print is placed inside the parenthesis. If the value is a message then we place it inside double quotes. If it’s a variable then we don’t need to place it inside double quotes

Example of Python print:

In the above example, we are displaying a message using print function. Text messages are placed inside double quotes (“)

In the above example, we can see that print function can show messages using double quotes (“), single quote (‘), triple single quotes (”’) or triple double quotes (“””)

Example of Python print for variable:

In the above example, we have used print function to show value of a variable named x.
Variables names are not placed inside double quotes. Variables and data types are explained in another lesson.

Example of Python print for multiple values:

In the above example, we have used one print function to show value of a variable and also string type message. variables and string are separated using a comma (,) in print function.