Skip to content

Instantly share code, notes, and snippets.

@EdwinTai
Created October 28, 2020 17:48
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 EdwinTai/003cc0a3d7c6e87a5a199d9ac21412ec to your computer and use it in GitHub Desktop.
Save EdwinTai/003cc0a3d7c6e87a5a199d9ac21412ec to your computer and use it in GitHub Desktop.
#整數
print(8888)
#二進位0b
print(0b001)
print(0b010)
print(0b011)
#八進位0o
print(0o010)
print(0o011)
#十六進位0x
print(0x0011)
print(0x000F)
#int轉型
print(int(True))
print(int(False))
#整數無窮大小 階乘
num = int(input("n!=? input n="))
factorial = 1
#check integer and not negative
if num < 0:
print("not negative")
elif num == 0:
print()
else:
for i in range(1,num + 1):
factorial = factorial*i
print("%d! = %d" %(num,factorial))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment