# What Data Type Is Num?

//

Scott Campbell

When working with programming languages, understanding data types is essential. Each variable or value in a program has a specific data type that determines the kind of data it can hold and the operations that can be performed on it.

## Introduction to Data Types

Data types categorize values into different groups, allowing the computer to allocate memory and perform operations accordingly. In Python, one of the most commonly used data types is num.

### What is num?

The num data type in Python represents numerical values. It includes both integers (whole numbers) and floating-point numbers (numbers with decimal points).

### Examples of num Data Type

To understand better, let’s look at some examples:

• Age: 25
• Temperature: 98.6
• Price: 19.99

In these examples, the age is an integer value, while temperature and price are floating-point values.

## Operations on num Values

The num data type allows us to perform various mathematical operations such as addition, subtraction, multiplication, and division.

To add two num values together, we use the “+” operator.

``````
num1 = 5
num2 = 10
result = num1 + num2
print(result) # Output: 15
``````

### Subtraction (-)

To subtract one num value from another, we use the “-” operator.

``````
num1 = 15
num2 = 7
result = num1 - num2
print(result) # Output: 8
``````

### Multiplication (*)

To multiply two num values, we use the “*” operator.

``````
num1 = 4
num2 = 6
result = num1 * num2
print(result) # Output: 24
``````

### Division (/)

To divide one num value by another, we use the “/” operator.

``````
num1 = 20
num2 = 5
result = num1 / num2
print(result) # Output: 4.0
``````

## Conclusion

The num data type in Python is used to represent numerical values. It includes both integers and floating-point numbers. Understanding how to work with this data type is crucial for performing mathematical operations in your programs.

Remember to use the appropriate data types when working with different kinds of values, as it ensures accurate calculations and prevents unexpected errors.