Data Types | BUS 104 – Python Exam

To view the VIDEO for this concept, you must purchase Python Cram Kit or Lifetime Access. Already purchased? Click here to log in.

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

Strings are any characters enclosed in quotation marks.

So, this is a string:

"Hello"

But this is not a string...

Hello

...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...

PAID CONTENT

This is the end of the preview. To unlock the rest, get the Python Cram Kit or Lifetime Access.

Already purchased? Click here to log in.

Leave a Comment