Python Programming - Variables - Discussion

Discussion Forum : Variables - General Questions (Q.No. 6)
6.
Which of the following is not a valid data type?
int
float
decimal
str
Answer: Option
Explanation:
In Python, the decimal data type is not built-in but can be imported from the decimal module. The other data types listed (int, float, and str) are built-in data types in Python.
from decimal import Decimal

# Using the Decimal data type to perform precise arithmetic
x = Decimal('10.5')
y = Decimal('3')
result = x / y

print(result)  # Output: 3.500000000000000000000000000
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.