Data Types | 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!

There are 4 main types of data that we'll be utilizing in Python: strings, integers, floats, and booleans. Let's dive into each of them!


Strings are any characters enclosed in quotation marks.

So, this is a string:


But this is not a string...


...since it's not enclosed in quotation marks.

str() function

To convert anything into a string, surround it with the str() function.

For example, if I had the following variable assigned to a number...

x = 123

...and surrounded it with the str() function...

x = 123
str(x) would then take on a value of "123" instead of 123.

The str() function is very useful when concatenating integers/floats with strings, since you can't combine them in the same print function!

To visualize this, you cannot do the following:

print("My favorite number is " + 4)

You must surround the integer like so:

print("My favorite number is " + str(4))


What's an integer?

An integer is any number without a decimal place.

So, this is an integer:


But this is not an integer...


...since it has a decimal place.

int() function

To convert a user inputted value into an integer, utilize the int() function!

An example of this is if I were to ask you for your age:

age = input("What's your age?")

Technically, this isn't good practice since all inputs return strings. So if you said that you were 18 years old, your age would be saved as "18" (a string) instead of 18 (an integer). Your age is not a string, it's an integer.

Therefore, to fix this you should surround your input() function with the int() function like so:

age = int(input("What's your age?"))

This makes it so your age is 18, like it should be!


A float is a number with decimal places.

So, this is a float:


But this is not a float...


...since it doesn't have any decimal places.

float() function

To convert a user inputted value into a float, utilize the float() function!

An example of this is if you were to input the price of a good:

price = input("What's the price of the product?")

Let's say you enter 12.99. Since inputs return as strings, this would save the price of the good as "12.99" (a string) when it should be 12.99 (a float). A price should not be a string, it should be a float.

To correct this, you should surround your input() function with the float() function like this:

price = float(input("What's the price of the product?"))

This causes the price to be saved as 12.99, as it should!


A boolean is true or false.

Yup, it's that simple.

So, this variable is a boolean...

lives_in_california = True

...but this variable is not a boolean...

age = 18

...since it's not true or false.

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!

Now that we've got a grasp of the different types of data we'll be working with in Python, let's move onto understanding how nested conditionals work. Click below to continue!


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