def combination(m,n):
if n==0 or m==n:
return 1
else:
return combination(m-1,n)+combination(m-1,n-1)
m = int(input('please fill m value :'))
n = int(input('please fill n value :'))
ans = combination(m,n)
print(ans)
Python - combination
Python - summation
def summation(num):
if num == 1:
return 1
else:
return num + summation(num-1)
n = int(input('please fill in an integer number :'))
ans = summation(n)
print('the result is :', ans)
Python - adding label
def label(sentence):
y = str('') + sentence + str('
')
print(y)
s = str(input('please paste code :'))
ans = label(s)
Python - 查日期
from datetime import datetime
#import datetime
def ymd():
now = datetime.now()
return (now.year, now.month, now.day)
y, m, d = ymd()
print(y,m,d)
Python - 質數檢查
import math
def prime(num):
j = 2
while j<=math.sqrt(num):
if(num % j == 0):
return False
j += 1
return True
for i in range(2,101):
if prime(i):
print(i,'is prime number')
訂閱:
文章 (Atom)
原人論-會通本末第四
會通本末第四 ( 會前所斥,同歸一源,皆為正義 ) 真性雖為身本,生起蓋有因由,不可無端忽成身相。但緣前宗未了,所以節節斥之。今將本末會通,乃至儒道亦是 ( 初唯第五性教所說,從後段已去,節級方同諸教,各如注說 ) 。謂初唯一真靈性,不生不滅,不增不減,不變不易。眾生無始迷睡...