适合Python使用的开发环境
最后更新于:2022-04-01 21:47:51
Python程序调试的一些体会
最后更新于:2022-04-01 21:47:49
十四、Python编程计算24点(之二)
最后更新于:2022-04-01 21:47:46
1 2 3 4 5 | |
1 2 3 4 5 6 7 | |
1 2 3 4 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
1 2 3 4 5 6 7 8 9 10 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
十三、Python编程计算24点(之一)
最后更新于:2022-04-01 21:47:44
十二、Python简单数据结构应用(之…
最后更新于:2022-04-01 21:47:42
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # -*- coding=utf-8 -*- def is_matched(expr): def validate (instr): |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | def separation (x): |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | defsuffix_expression_r(exprinlist): |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | defcalculation(expression): |
1 2 3 4 5 6 7 8 9 10 11 12 13 | expr ="3+(2-5)*6.0/3" if notis_matched(expr): else: |
十一、Python简单数据结构应用(之…
最后更新于:2022-04-01 21:47:39
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | def comb(iterable, r,order=1): print "\ncomb-----" comb1=comb(tuple('123456'),4) for e in comb1: printe print len(comb1) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | def combusestack(iterable, r,order=1): print "comb usestack-----" comb1=combusestack(tuple('123456'),4) for e in comb1: printe print len(comb1) |
1 2 3 4 5 6 7 8 9 10 11 12 | defrev(s): printrev('123456789') printrev('') |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | defis_matched(expr): printis_matched('[(5+x)-(y+z)]') printis_matched('{(5+x)-(y+z)]') printis_matched('[(5+x)-(y+z))') |
十、Python编程解决组合问题(之二…
最后更新于:2022-04-01 21:47:37
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | def combinations(iterable, n): print "\nChange from python itertools" comb1=combinations(('zhao','qian','sun','li','zhou','wu'),4) for e in comb1: print e print len(comb1) |
九、Python编程解决组合问题(之一…
最后更新于:2022-04-01 21:47:35
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | def combNumberLoop4(m, b): group=[99,99,99,99] print "\nUsing Loop: %d\n" % combNumberLoop4(6, group) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | def combNumber(m, n, b): group=[99,99,99,99,99] totalNumberR = 0 print "\nUsing Recursive: %d\n" % combNumber(7,5,group) |
八、Python的函数编程(之二)
最后更新于:2022-04-01 21:47:32
>>>s = 'Hello, world.' >>>str(s) 'Hello, world.' >>>repr(s) "'Hello, world.'" >>>str(0.1) '0.1' >>>repr(0.1) '0.10000000000000001' >>>x = 10 * 3.25 >>>y = 200 * 200 >>>s = 'The value of x is ' + repr(x) + ', and y is ' + repr(y) +'...' >>>print s The value of x is 32.5, and yis 40000... >>># The repr() of a string adds string quotes andbackslashes: ... hello = 'hello,world\n' >>>hellos = repr(hello) >>>print hellos 'hello, world\n' >>># The argument to repr() may be any Python object: ... repr((x, y, ('spam','eggs'))) "(32.5, 40000, ('spam','eggs'))" |
七、Python的函数编程(之一)
最后更新于:2022-04-01 21:47:30
1 2 3 4 5 6 | def fib(n): |
1 2 3 4 5 6 | deffib(n=2000): |
1 2 3 4 5 6 7 8 | def fib2(n): # returnFibonacci series up to n |
1 2 3 4 5 6 7 8 9 | def foo(): bar = 100 print "in __main__, bar is",bar foo() print "\nin __main__, bar is(still)", bar |
1 2 3 4 5 6 7 8 9 10 | def foo(): bar = 100 print "in __main__, bar is",bar foo() print "\nin __main__, bar is(still)", bar |
六、Python的程序流程
最后更新于:2022-04-01 21:47:28
1 2 3 4 5 6 | >>>i=[1,2,3,4] >>>x=3 >>>if x<9 and x in i: ... ... true answer |
1 2 3 4 5 6 | >>>if x<4: ... ... ... ... big |
1 2 3 4 5 6 7 8 | >>>x=7 >>>if x>0: ... ... ... ... ... small |
1 2 3 4 5 6 7 8 | >>>x=7 >>>if x>0: ... ... ... ... ... small |
1 2 3 4 5 6 7 8 9 | >>>x=9 >>>if x>10: ... ... ... ... ... ... middle |
1 2 3 4 5 6 7 8 9 10 11 12 | >>>x=0 >>>while x<7: ... ... ... the numberis the numberis the numberis the numberis the numberis the numberis the numberis |
1 2 3 4 5 6 7 8 9 | >>>alist=[1, 2, 3, 4, 5] >>>for eachnumber in alist: ... ... 1 is a integer 2 is a integer 3 is a integer 4 is a integer 5 is a integer |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | >>>for eachletter in 'HelloPython': ... ... this is letter H this is letter e this is letter l this is letter l this is letter o this is letter P this is letter y this is letter t this is letter h this is letter o this is letter n |
1 2 3 4 5 6 | sum = 0 i = 1 while sum + i <=10000: print "from 1 to %d, the sum is%d(near 10000)" % (i, sum) |
1 2 3 4 5 | sum = 0 for i inrange(1,10001): print "sum 1 to 10000 is equal%d" % sum |
五、Python的语言基础
最后更新于:2022-04-01 21:47:26
1 2 3 4 5 6 | >>>MyExample= 6 >>>print(MyExample) 6 >>>MyExample=7 >>>print(MyExample) 7 |
1 2 3 4 5 6 7 8 | >>>(1+3)*4 16 >>>1+3*4 13 >>>3*4/(4*7) 0.42857142857142855 >>>3*4/4*7 21.0 |
四、Python语言简单介绍
最后更新于:2022-04-01 21:47:23
1 | print (“hello”) # commentone |
1 2 3 4 5 6 7 8 9 10 | >>>3+5 8 >>>3<4 True >>>3!=4 True >>>2>4 and 3<4 False >>>2>4 or 3<4 True |
1 2 3 4 5 6 | >>>start=2 >>>start 2 >>>second="two" >>>second 'two' |
1 2 3 4 5 6 | >>>a=1234569l >>>type(a) <type'long'> >>>b=-12345678901234567890123l >>>type(b) <type'long'> >>> |
1 2 3 4 5 6 | >>>alist=[1, 2, 3, 4, 'hello'] >>>alist [1, 2, 3, 4,'hello'] >>>atuple=(1, 2, 3, 4, 'hello', 'Python') >>>atuple (1, 2, 3, 4, 'hello','Python') |
1 2 3 4 5 | >>>first_Dict={ 'Hello': 'Python', 'First': 1} >>>first_Dict {'First': 1, 'Hello':'Python'} >>>first_Dict ['Hello'] 'Python' |
1 2 3 4 5 | >>>x=-1 >>>if x<0: ... ... hello |
1 2 3 4 5 6 7 8 9 | >>>x=1 >>>while x<5: ... ... ... circle # 1 circle # 2 circle # 3 circle # 4 |
1 2 3 4 5 6 7 8 | >>>alist=[1, 2, 3, 4] >>>for i in alist: ... ... 1 2 3 4 |
三、计算机语言的介绍
最后更新于:2022-04-01 21:47:21
二、计算机系统的简单介绍
最后更新于:2022-04-01 21:47:19
一、Python语言的入门
最后更新于:2022-04-01 21:47:16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | #include #include ##include #include #include #define MAX int { for(i= printf("\n"); return } |
高中生如何学习编程
最后更新于:2022-04-01 21:47:14
前言
最后更新于:2022-04-01 21:47:12