python:practice random module verification code program
摘要: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
阅读全文
python:practice module generator of list time jison
摘要: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)]
阅读全文
python :practice integrated decorator three categories
摘要:python decorator is a crucial(vital,signifiant) process. decorator mail two category 1:principal function no arguments(parameters): for example: princ
阅读全文
python:practice decorator calaulate_time
摘要: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
阅读全文
python:practice decorator closure function
摘要: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
阅读全文
python:practice renderer
摘要: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()()
阅读全文
python:practice built-in function
摘要: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+
阅读全文
python:practice fibo array
摘要: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
阅读全文
python: practice recurse function
摘要: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
阅读全文
python:practice highter-order function
摘要: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
阅读全文
python:practice set copy
摘要:content will be learn: how to use set. set is a object ,characters :not be repetitive,can be hashing. startup in two way : set () can be add and delet
阅读全文
python:practice function return
摘要:def add(*args): sum=0 for i in args: sum+=i add(1,2,3,4) print(add) # nano def add(*args): sum=0 for i in args: sum+=i return sum,123,[1,2,3] add(1,2,
阅读全文
python :practice function return
摘要:define function .return value is required. instance: def f(): print('hello world') return 10 # return represents two replications. 1:process is execut
阅读全文
python:practice stdout
摘要:import sys,time for i in range(10): sys.stdout.write('***") can output *************** standard input: stdin standard output: stdout test; import sys,
阅读全文
python: practice ,for i in range
摘要:list ,dict,tuple, or docentment all can use for in loop> number=0 for i in file: number+=1 if i ==3: i=" ".join((i.strip,'word') print(i) read article
阅读全文
python:practice shart file --operation object ,article,essay, paper,thesis
摘要:handle class: for instance read file(article,assay,thesis,paper,ect...)ddd file_read=open('d:\jetbrians.com\python\pycharm\guide','r',encoding='UTF-8'
阅读全文
python:practice encode decode
摘要:chinese Ascii unicode--utf-8 The history of compute programe develpement,as long as compute programing language. The C++,Java,Javascript,python,eclips
阅读全文
python:practice Advanced three-level menu
摘要:menu={'jx':{'shangrao':{'yiyang':{'zuoshenwei':{'staff':69,'money':9002869}, 'haungjia':{'landscape':'beatiful','dog':4} }, 'hengfeng':{}, 'yangshang'
阅读全文
python: practice three-level manu
摘要:menu={'china':{'jx_province':{'sr_manicipality':{'yiyang_country':['qinghu_town','guifeng_town','wangli_town']},},}, 'American':{'wathton.dc':{'ei':{'
阅读全文
python: practice string method
摘要:str='hello world' str.startswith('he') str.endswith{'y"} str.expendtabs() st='he \t llo world' st.expandtabs(tabsize=10) st.find('e') :find first elem
阅读全文
python:practice dict
摘要:dic={'name':'alan','age':12,'city':'canton'} for i in dic: print(i,dic[i]) for i in dic.items(): print(i) for items in dict.items(): print(items) for
阅读全文
python:practice class dict add,del,amend,check
摘要:new dict dict={} dict1=dict((())) dict2=dict.fromkeys([1,2,3,4],[2,3,9]) dict={'key':value','key':'value','key':'value'} dict['key']='value' dict.popi
阅读全文
python: for practice and trianing case purchase cart
摘要:commodity_list=[('bicycle',9000),('iphone',20000),('tesla',20000),('python book',109),('mac book',2000)] deposit=input('please input your budget:') if
阅读全文