Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
Data Types
Python Data types are the classification or categorization of data items. It
represents the kind of value that tells what operations can be performed on a particular data.
1. Numeric Data Types in Python
The numeric data type in Python represents the data that has a numeric value. A numeric value can be an integer, a floating number, or even a complex number. These values are defined as Python int , Python float , and Python complex classes in Python .
Integers – This value is represented by int class. It contains
positive or negative whole numbers (without fractions or decimals). In Python, there is no limit to how long an integer value can be.
Float – This value is represented by the float class. It is a real
number with a floating-point representation. It is specified by a decimal point. Optionally, the character e or E followed by a positive or negative integer may be appended to specify scientific notation.
Complex Numbers – A complex number is represented by a
complex class. It is specified as (real part) + (imaginary part)j . For example – 2+3j String Data Type Strings in Python are arrays of bytes representing Unicode characters. A string is a collection of one or more characters put in a single quote, double-quote, or triple-quote. In Python, there is no character data type Python, a character is a string of length one.