Skip to content

Instantly share code, notes, and snippets.

@feulf
Created October 29, 2019 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save feulf/f2f56e01b37e492a3f37efec4b03319e to your computer and use it in GitHub Desktop.
Save feulf/f2f56e01b37e492a3f37efec4b03319e to your computer and use it in GitHub Desktop.
Data Types in Python
# Boolean
# ------------------
print(True)
print(False)
print(type(True))
# Integers
# ------------------
# Python 3 has no limit for the data size. Aside the memory of course.
# decimal by default
print("Decimal")
print(123123123123123123123123123123123123123123123123 + 1)
# 123123123123123123123123123123123123123123123124
# Binary
print("Binary")
print(0b00000001)
print(0b00000010)
print(0b00000011)
print(0b00000100)
print(0b00000101)
print(0b00000110)
print(0b00000111)
print(0b00001000)
# Hex
print(0xAA)
# Print the type
print(type(0xAA))
# Floating point
# ------------------
print(4.2)
print(42e-1)
# Most python implementations represent python as a 64-bit double-precision value.
# Anything bigger it will be represent as "Inf"
print(1.79e308)
print(1.8e308)
# String
# ------------------
print('Bitcoin fixes this')
print(type('Bitcoin fixes this'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment