Skip to content

Instantly share code, notes, and snippets.

@rishisidhu
Created April 10, 2020 10:56
Show Gist options
  • Save rishisidhu/67a80467b7cf4773c6725aefa6bf96f0 to your computer and use it in GitHub Desktop.
Save rishisidhu/67a80467b7cf4773c6725aefa6bf96f0 to your computer and use it in GitHub Desktop.
Integers in Python
a = 10 # Integer
b = -9 # Integer can be negative
c = 0b011 # Integer can be Binary
d = 0o123 # Integer can be Octal
e = 0x9AF # Integer can be Hexadecimal
print("Positive Integer = ",a, " | ", type(a))
print("Negative Integer = ",b, " | ", type(b))
print("Binary Integer = ",c, " | ", type(c))
print("Octal Integer = ",d, " | ", type(d))
print("Hexadecimal Integer = ",e, " | ", type(e))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment