摘要:
random :third party libraries common usage: random.randint(10) random.randrange(10) random.choice(1,2) random.choices random.shuffle([1,2,3]) so on cr
阅读全文
posted @ 2020-03-17 10:49
alansuny
阅读(119)
推荐(0)
编辑
摘要:
content: 1:generator of list【】: list=[x for x in range(10)] realize:[0,1,2,3,4,5,6,7,8,9] list=[x 2 for x in range(10)] list=[x x for x in range(10)]
阅读全文
posted @ 2020-03-16 12:12
alansuny
阅读(95)
推荐(0)
编辑
摘要:
python decorator is a crucial(vital,signifiant) process. decorator mail two category 1:principal function no arguments(parameters): for example: princ
阅读全文
posted @ 2020-03-15 21:34
alansuny
阅读(95)
推荐(0)
编辑
摘要:
from functools import reduce import time def factorial_array(n) number=reduce(lambda x,y:x*y,range(1,n+1)) return number print( factorial_array(101) d
阅读全文
posted @ 2020-03-15 19:56
alansuny
阅读(114)
推荐(0)
编辑
摘要:
instances: def func(): x=10 def inner(): print(x) return inner a=func() a() result of execute is 10 print(a()) result of execute is none :because the
阅读全文
posted @ 2020-03-15 14:05
alansuny
阅读(154)
推荐(0)
编辑
摘要:
function domain: L ocal E nclosing Global Built-in instance: def outer(): x=10 def inner(): print(x) return inner call inner method 1:print (outer()()
阅读全文
posted @ 2020-03-15 12:48
alansuny
阅读(130)
推荐(0)
编辑
摘要:
built-in function,is python already prepar for us ,anytime we can call built-in function when we needed it . all() dict() help() all([1,2,'') eval('1+
阅读全文
posted @ 2020-03-15 11:13
alansuny
阅读(141)
推荐(0)
编辑
摘要:
fibo digit array: 1 2 3 4 5 6 7 8 9 10 11 0 1 1 2 3 5 8 13 21 34 55 we can find out the rule(law ,regularity,disciplinarian). the number equity before
阅读全文
posted @ 2020-03-15 09:31
alansuny
阅读(114)
推荐(0)
编辑
摘要:
starting with a factorial : def function_factorial(n): number=1 for i in range(1,n+1): number *=i return number print(function_factorial( n) use this
阅读全文
posted @ 2020-03-15 07:31
alansuny
阅读(97)
推荐(0)
编辑
摘要:
def print_all(x,y,z): print(z(x)+z(y)) print_all(3,3,get) 60 higher-order function: define: at least satisify one in two condition .accept one or more
阅读全文
posted @ 2020-03-14 22:27
alansuny
阅读(91)
推荐(0)
编辑