Created
October 28, 2020 17:48
-
-
Save EdwinTai/003cc0a3d7c6e87a5a199d9ac21412ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#整數 | |
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