# Numeric Data Types and Character Sets

Integers in python are 0, positive and negative whole numbers. They are written without commas and when using a negative integer, it leads with a negative sign. The code is int data type, the python integers are large and limited only by the computer’s memory.

Floating-Point Numbers consist of a whole number, a decimal point, and a fractional part. Infinite Precision is the property of a real number, in which its fractional part consists of an infinite number of digits. Python uses floating -point numbers which is a data type that represents real numbers in a computer program. It can be written in either decimal notation or scientific notation. Here is an example of decimal notion 3.78 and scientific 3.78e0.

Character Sets in Python, character literals look just like string literals and are of the string type. Example ‘H’ is a character and “Hi!” as a string. ASCII and Unicode are the sets, ASCII set is the American Standard Code for Information Interchange ordering for a character set. Unicode Set is a character set that uses 16 bits to represent over 65,000 possible characters. These include the ASCII character set as well as symbols and ideograms in many international languages. You can look at a ASCII table and determine what they are. Python ord and chr function convert characters to their numeric ASCII codes and back.

Example

ord('a")

97

chr(65)

‘A’

RefLAMBERT, K. E. N. N. E. T. H. A. (2018). Fundamentals of python - first programs Pg Chapter 2, 2-3 through 2-3c

Hi Mark,

I’m afraid that you are mistaken about floating point.

You wrote:

“”"
Floating-Point Numbers consist of a whole number, a decimal point, and a
fractional part. Infinite Precision is the property of a real
number, in which its fractional part consists of an infinite number of
digits.
“”"

That is incorrect. Almost all programming languages have only finite
precision for floating point numbers, and Python is one of them. In the
case of Python, floats have 64 bits.

(There are some programming languages which can support arbitrary
precision for floating point numbers, but that’s not the same as an
infinite number of digits. No computer in the world has got enough
memory to store an infinite number of digits.)

In Python’s case, we can see that floats do not represent pure
mathematical real numbers, because they can only store approximately 16
decimal places. For example, the smallest float we have in Python (apart
from zero) is 5e-324. If you try to half it, you get zero:

``````>>> 5e-324 / 2
0.0
``````

Likewise, you mentioned Unicode:

“”"
Unicode Set is a character set that uses 16 bits to represent over
65,000 possible characters. These include the ASCII character set as
well as symbols and ideograms in many international languages.
“”"

That is also incorrect. In Python, Unicode strings will use up to 4
bytes (32 bits) to represent 1,114,112 different characters. Although,
to be fair, most of them are not yet defined. Unicode currently only
defines (approximately) 283,506 of those possible characters.

Your correct, I miss read and confused real number with Floating-point numbers. Thanks for the correction.