Beginner Python Concepts

a-Rye
49.6K views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

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.
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content