Primitive Data Types

Primitive data types

Primitive data types are fundamental data types in a programming language that represent simple values. For instance, numbers, strings, etc.

Integers

Integers (int): Whole numbers that don’t have decimal points or aren’t fractions.

Press + to interact
course_rank = 1
print("Course rank:", course_rank)

Floats

Floats (float): Numbers that have a decimal point or are in exponential form.

Press + to interact
value_of_pi = 3.14
print("The value of pi is:", value_of_pi)

Strings

Strings (str): Sequences of characters. The characters can be letters, numbers, symbols, spaces, or other special characters.

Press + to interact
our_message = "Welcome to Educative! Let's learn Python Data Variables!"
print("Our Message:", our_message)

Note: A string can be defined used single (' '), double (" "), or triple quotation marks (""" """). However, double quotation marks are the generally accepted way. Triple quotation marks are usually used for multiline strings.

Booleans

Booleans (bool): Logical operation keywords. A Boolean represents either True or False.

Press + to interact
is_learning_python = True
print("Python Status:", is_learning_python)

NoneType

NoneType (None): Represents the absence of a value or a null value.

Press + to interact
none_variable = None
print("None Variable:", none_variable)