Back
Close

Beginner Python Concepts

a-Rye
25.5K views

Primitive Variables

Primitive Variables are simple, single value variables used in computing. Think of them as shipping boxes to contain data. You need the right type of shipping box / container for different types of data.

Now, with Python, it's harder to see what type a variable is. Python does not require you to declare the type of variable when declaring Primitive variables (as opposed to objects).

  • Strings / Arrays of Chars = "Hello World!" / "This is also a string" / Any group of characters contained in single ('') or double ("") quotes
  • Chars / Characters = 'a', 'b', 'Z', '!' / Any single letter or character. Can be in single or double quotes (for Python, not necessarily other languages)
  • Ints / Integers = 5 / 4 / 5,000,000 / any whole number
  • Float / Floating Point = 10.0
  • Bool / Boolean = True / False
To see what type your variable is, use the built-in type() function.
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io