Datatypes

Datatypes #


We will be exploring different datatypes


  1. Integer
  2. String
  3. Float
  4. Boolean

Integer #

  • Any whole number

Examples #

5
10
102310

String #

  • Any letters, numbers, and characters
  • Quotation marks are needed around the value
    • It can be either single or double quotes

Examples #

'Hi'
"I like to move it"
'P0k3m0n'

Float #

  • Any number with a decimal

Examples #

23.325
34.1124
3.14

Boolean #

  • True or False

Examples #

True
False

type() #

type()

By adding any object within the parenthesis, it will return the type of it


Lets try it for an integer

print(type(5))

Will print out

<type 'int'>

It returns that value 5 has a type of int , which means integer


Lets try it for a string

print(type('hi'))

Will print out

<type 'str'>

It returns that value 'hi' has a type of str , which means string


Lets try it for a float

print(type(5.2102))

Will print out

<type 'float'>

It returns that value 5.2102' has a type of float .


Lets try it for a boolean

print(type(True))

Will print out

<type 'bool'>

It returns that value True has a type of bool , which means boolean