Print function | BUS 104 – Python Exam

Still feeling nervous for your exam? Check out the Python Cram Kit for practice questions that emulate the difficulty that you'll face on your exam. Each question includes a thorough step-by-step explanation where I walk you through the entire problem solving process!

The print() function explained

Imagine yourself jotting a to-do list onto a Post-it Note.

Your writing content directly onto a Post-it.

That's exactly what the print() function does, except instead of writing content onto a Post-it, it writes content in the output.

print() enables you to write content directly in the output.

Coding a print() function

Let's write a print() function of the to-do list above!

Make sure to open a Trinket file to follow-along! (How to create a Trinket file?)

First, let's check out this template for print() functions.


So, to write the first to-do item onto our webpage, we'll type the following into the content.

print("- Take out the trash")

But, what about the rest of our to-do items?

To include these, all we need to do is write additional print() functions.

print("- Take out the trash")
print("- Do the dishes")
print("- Order wig for date party")

Type the code above into your Trinket file. It should look like this now:

Run your file by pressing the "Run" button above your code. You should get the following output on the right of your screen:

How do I include empty lines?

What if we wanted our to-do list to look like this instead?

To include these empty lines in-between each to-do list item, all we need to do is include empty print() functions!

print("- Take out the trash")
print("- Do the dishes")
print("- Order wig for date party")

Just writing "print" will place an empty line in your output.

Manually type the above highlighted code into your Trinket file. It should look like this now:

Now run your file. You'll see each to-do item is separated by one line like the image below!

Printing integers and floats

We've currently been printing strings. We can print integers and floats as well!

Here's an example of printing an integer:


Here's an example of printing a float:


If you want more information on strings, integers, and floats, I've made Data Types | Python in 30 Minutes for you!

Practice problem

Create a new Trinket file and code a print() function that writes "Hello there!" on the first line, then "What's going on?" below it. Separate these sentences with an empty line.

Your final output should look like so:

Desired output of the practice problem, with "Hello there!" and "What's going on?" written below it

print("Hello there!")
print("What's going on?")

Python Follow-along Guide

It's no secret you retain info better when you write it down. That's why I created the Python Follow-along Guide for you!

As you come upon key concepts highlighted in yellow, like this sentence here, you can fill-in-the-blanks on your Python Follow-along Guide so that you remember all the important stuff for later!

You can obtain your Python Follow-along Guide for FREE by entering your email below!

Next up, we'll learn how to take in user-inputted data with the input function. Click below to move on!


Each exam concept broken down with relatable situations to your life!

ToolsPython Follow-along Guide (FREE)
LessonPrint function
LessonInput function
LessonConditionals (if, elif, else)
LessonWhile loops
LessonFor loops
LessonData Types
LessonNested Conditionals
LessonFlag Variables

Practice Problems

Include step-by-step explanations through each part of the problem!

Python Cram Kit Logo

"...I was blown away with the videos and the ability to explain what is going on at a simple level. Highly recommend!"

Jack Whelan
March 8, 2021

Rating: 5 out of 5.

Leave a Comment