Number System Name | Range | Base | Start |
Binary Number System | 0-1 | 2 | 0B or 0b |
Decimal Number System | 0-9 | 10 | |
Octal Number System | 0-7 | 8 | 0O or 0o |
Hexa-decimal Number System | 0-15 | 0-9 a-f | 0X or 0x |
Binary Number System use for digital Signal
def getBinaryValue(): a=0b101010 b=0B111111 print(a," ",b) getBinaryValue()
42 63
def getDecimalValue(): a=1234 b=4321 print(a," ",b) getDecimalValue()
1234 4321
def getOctalValue(): a=0o123 b=0O321 print(a," ",b) getOctalValue()
83 209
def getHexadecimalValue(): a=0x1a2b3f b=0X3a2d1e print(a," ",b) getHexadecimalValue()
1715007 3812638
def getAnyASCIIValue(): value=input("Enter any value and get ASCII value : ") print(ord(value)) getAnyASCIIValue()
Enter any value and get ASCII value : ~ 126 Enter any value and get ASCII value : @ 64 Enter any value and get ASCII value : a 97 Enter any value and get ASCII value : A 65
def getInBinaryFrom(): value=int(input("Enter any value and get Binary value : ")) print(bin(value)) getInBinaryFrom()
Enter any value and get Binary value : 12345 0b11000000111001
def getInOctalFrom(): value=int(input("Enter any value and get Binary value : ")) print(oct(value)) getInOctalFrom()
Enter any value and get Binary value : 123456 0o361100
def getInHexadecimalFrom(): value=int(input("Enter any value and get Hexadecimal value : ")) print(hex(value)) getInHexadecimalFrom()
Enter any value and get Hexadecimal value : 123 0x7b