According to the mathematics we have 4 types of number systems which are representing the numbers in computer architecture. In this tutorials, we are going to learn how to deal with these number systems in Python Language.

## Python Number Systems :

Python number system is representing the way of using the below numbers in Language.

- Binary Number System
- Octal Number System
- Decimal Number System
- Hexadecimal Number System

Lets see one by one, how these are used in python language.

## Binary Number System :

- In general a binary number represents the 0 and 1 in the system.
- The base or radix of the binary number system is 2.
- The possible digits that are used in binary number system are 0 and 1.
- To represent a binary number in Python as a input, the number should be starts with
.**0b**

## Example : Python binary Number System

x = 0b1010 print('Value is : ',x)

**Output :**

(Value is : 10)

**Note :** we can not give the since binary numbers contains only 0 and 1. If so we will get error message like SyntaxError: invalid syntax.**x=ob1020**

## Octal Number System :

- The base or radix of the octal number system is 8.
- The possible digits that are used in octal number system are 0 to 7.
- To represent a binary number in Python as a input, the number should be starts with
.**0 (python2) or ox (python3)**

## Example : Python octal Number System

x=0123 print('Value is : '+x)

**Output :**

(Value is : 83)

**Note :** we can not give the since octal numbers contains from 0 to 7. If so we will get error message like SyntaxError: invalid token.**x=o180**

## Decimal Number System :

- The base or radix of the decimal number system is 10.
- The possible digits that are used in decimal number system are 0 to 9.
- The default number system followed by python is decimal number system.

x=1234 print('Value is : '+x)

**Output :**

(Value is : 1234)

**Note :** we can not give the since the decimal numbers contains from 0 to 9. If so we will get error message like SyntaxError: invalid syntax.**x=1234p**

## Hexadecimal Number System :

- The base or radix of the hexadecimal number system is 16.
- The possible digits that are used in hexadecimal number systems are 0 to 9 and a to f.
- To represent a binary number in Python as a input, the number should be starts with
.**0x**

x=0x25 print('Value is :'+x)

**Output :**

(Value is : 37)

**Resources :**

Happy Learning 🙂

## Leave A Comment