# 程式設計個人筆記 管學一 周宗永 ------------ 程序設計第一堂筆記 --------------- Operator Name Example + Addition x + y - Subtraction x - y * Multiplication x * y / Division x / y % Modulus x % y ** Exponentiation x ** y // Floor division x // y == Equal x == y != Not equal x != y > Greater than x > y < Less than x < y >= Greater than or equal to x >= y <= Less than or equal to x <= y [](https://) Operator Name Example = x = 5 x = 5 += x += 3 x = x + 3 -= x -= 3 x = x - 3 *= x *= 3 x = x * 3 /= x /= 3 x = x / 3 %= x %= 3 x = x % 3 //= x //= 3 x = x // 3 **= x **= 3 x = x ** 3 &= x &= 3 x = x & 3 |= x |= 3 x = x | 3 ^= x ^= 3 x = x ^ 3 >>= x >>= 3 x = x >> 3 <<= x <<= 3 x = x << 3 print("ok") ok x=5 y=4 print(x+y) 9 x=4 y=5 print(x*y) 20 x=4 y=5 print(x/y) 0.8 x=5 y=4 print(x//y) 1 x=5 y=4 print(x**y) 625 x=5 y=4 print(x//y) 1 x=9 y=5 print(x**y) 59049 x=3 x+=10 print(x) 13 x=9 y=5 print(x>=y) or (y<=100) True True 第二堂課筆記 --------- import math print(math.floor(4.5)) print(math.ceil(4.5)) 4 5 #將5,10,25作爲參數傳送到min來運算作爲x的指定數字 #將5,10,25作爲參數傳送到max來運算作爲y的指定數字 x = min( 5,10, 25) y = max(5, 10, 25) print(x) print(y) 5 25 #abs為取絕對值 x = abs(-7.25) #印入x print(x) 7.25 #將4和3傳送到pow變成4的立方也成爲x的指定函數 x = pow(4, 3) #印入x print(x) 64 import math #math.sqrt為square roots x = math.sqrt(100) print(x) 10 #注解math模組 import math #把(1.4)當成參數,傳入math.ceil()函數中 #把(1.4)當成參數,傳入math.floor()函數中 x = math.ceil(1.4) y = math.floor(1.4) #印出 print(x) # returns 2 print(y) # returns 1 2 1 import math x = math.pi print(x) 3.141592653589793 import math a=(math.sqrt(7)-math.sqrt(5))/(math.sqrt(7)+math.sqrt(5)) print ((a**3)+(1/a**3)) 1692.0000000000002 import math x=math.log10(4000)/math.log10(5/4) y=math.log10(5000)/math.log10(5/4) n=math.ceil(x) n=math.floor(y) print(n) 38 填充8. import math x=1/((math.sqrt(2))+1) pow(x,4)+2*pow(x,3)-3*pow(x,2)+5*x+1 =2.7279220613578556 第一次小組作業筆記 -------------- import math x=math.sqrt(6) y=(1/math.sqrt(3))-(1) (x)*(y) -1.0352761804100827 import math x=(2*y)+1 y=(-x)+(13) print(x) print(y) 0.15470053837925168 12.845299461620748 import math (math.pow(-3,4))-(math.pow(7,2))-((math.pow(2,6))/(math.pow(-2,3))) 40.0 import math ((math.pow(3*x,5))-(math.pow(4*x,4))+(math.pow(5*x,3))+(math.pow(3*x,2))+(7*x)+(16)) print (x) 0.15470053837925168 import math x=(math.pow(103,4))-(81) u=(math.pow(103,2))+(9) y=(106) x/(u*y) 100.0 import math a=(math.pow(197,2))*(6)+(math.pow(3,2)) b=206*194 c=(math.pow(200,2))-(math.pow(3,2)) print(a>b>c)or(a>c>b) False True import math x=3 (math.pow(2,2*x))-(7)*(math.pow(2,x))-(8) 0.0 第三堂課筆記 ---------- #範例14-1:math函數 import math #印出所有math函數名稱 print(dir(math)) #常數pi, e print('常數 pi=', math.pi) print('常數 e=', math.e) #三角函數 #角度 = 30度 #degrees(x) 傳回弧度 x 的角度 (degree) #radians(x) 傳回角度 x 的弧度 (radian) d1 = 30 r1 = math.radians(d1) print('sin(30度) = ', math.sin(r1)) #反三角函數: arc Sin(0.5) = pi/6 r2 = math.asin(0.5) d2 = math.degrees(r2) print('ashin(0.5)= radians =',r2) print('ashin(0.5)= degrees =',d2) #factorial(x) 傳回 x 階乘 =x! d3 = math.factorial(5) print('5!=', d3) #絕對值 d4 = abs(-9) d5 = math.fabs(-7) print('絕對值 = abs(-9)=', d4) print('絕對值 = math.fabs(-7)=', d5) 自然指數 = math.exp(1) print('自然指數 = math.exp(1) = ', math.exp(1)) print('自然指數 = math.e = ', math.e) #求20,16的最大公因數 print('求20,16的最大公因數=', math.gcd(20,16)) #四捨五入,無條件捨去,無條件進位 print('6.7的四捨五入 =', round(6.7)) print('6.7的無條件捨去 =', math.floor(6.7)) print('6.7的無條件進位 =', math.ceil(6.7)) #5的3次方 print('5的3次方=', 5**3) print('5的3次方=', math.pow(5,3)) #開根號 print('25開根號 = ', math.sqrt(25)) 結果:['__doc__', '__loader__', '__name__', '__package__', '__spec__', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'copysign', 'cos', 'cosh', 'degrees', 'e', 'erf', 'erfc', 'exp', 'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'gamma', 'gcd', 'hypot', 'inf', 'isclose', 'isfinite', 'isinf', 'isnan', 'ldexp', 'lgamma', 'log', 'log10', 'log1p', 'log2', 'modf', 'nan', 'pi', 'pow', 'radians', 'remainder', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'tau', 'trunc'] 常數 pi= 3.141592653589793 常數 e= 2.718281828459045 sin(30度) = 0.49999999999999994 ashin(0.5)= radians = 0.5235987755982989 ashin(0.5)= degrees = 30.000000000000004 5!= 120 絕對值 = abs(-9)= 9 絕對值 = math.fabs(-7)= 7.0 自然指數 = math.exp(1) = 2.718281828459045 自然指數 = math.e = 2.718281828459045 求20,16的最大公因數= 4 6.7的四捨五入 = 7 6.7的無條件捨去 = 6 6.7的無條件進位 = 7 5的3次方= 125 5的3次方= 125.0 25開根號 = 5.0 #引用現成的模組 from sympy.interactive import printing printing.init_printing(use_latex=True) from sympy import * x = symbols('x') #一元多項式,相乘,展開 f = poly((x+1)*(x+1)*(x+1)) print(f) display(f) #二元多項式 x,y = symbols('x y') f = poly('(x+2*y+3)**2') display(f) #範例3-4:二元一次方程式聯立求解 from sympy import * x, y = symbols('x y') #二元一次聯立方程式 f1 = Eq(x + 2*y - 8, 0) f2 = Eq(2*x - y - 6, 0) p1 = None p1 = plot_implicit(f1,show=False) p2 = plot_implicit(f2,show=False) p1.extend(p2) p1.show() 求解兩條線的交叉點(solve(f1,f2)) print('解二元一次聯立方程式=', solve((f1,f2),(x,y))) Poly(x**3 + 3*x**2 + 3*x + 1, x, domain='ZZ') \displaystyle \operatorname{Poly}{\left( x^{3} + 3 x^{2} + 3 x + 1, x, domain=\mathbb{Z} \right)}Poly(x 3 +3x 2 +3x+1,x,domain=Z) \displaystyle \operatorname{Poly}{\left( x^{2} + 4 xy + 6 x + 4 y^{2} + 12 y + 9, x, y, domain=\mathbb{Z} \right)}Poly(x 2 +4xy+6x+4y 2 +12y+9,x,y,domain=Z) 解二元一次聯立方程式= {x: 4, y: 2} #範例5-1:求微分,常見的幾類微積分函數基本公式 from sympy import * x=symbols('x') f = Function('f')(x) #一階導數(對x) = 一階微分(對x) = diff(函數, x) f = 1/x print('求 y=1/x的微分=', diff(f, x)) f = 3*x**2 + 2*x + 5 print('求 y=3*x^2 + 2*x + 5的微分=', diff(f, x)) #常見的幾類微積分基本公式 f = sin(x) print('求sin(x)的微分=', diff(f, x)) f = cos(x) print('求cos(x)的微分=', diff(f, x)) #標準指數e的微分 f = E**x print('求E**x的微分=', diff(f, x)) f = exp(x) print('求exp(x)的微分=', diff(f, x)) #自然對數e的微分 #自然對數 = ln() #10為底的對數 = log() f = ln(x) print('求自然對數ln(x)的微分=', diff(f, x)) #多項式的微分 #如果方程式有未知參數n,就必須要加上'' f = 'x**n' print('求x**n的微分=', diff(f, x)) f = x**5 print('求x**5的微分=', diff(f, x)) 求 y=1/x的微分= -1/x**2 求 y=3*x^2 + 2*x + 5的微分= 6*x + 2 求sin(x)的微分= cos(x) 求cos(x)的微分= -sin(x) 求E**x的微分= exp(x) 求exp(x)的微分= exp(x) 求自然對數ln(x)的微分= 1/x 求x**n的微分= n*x**n/x 求x**5的微分= 5*x**4 if 5 > 2: print("Five is greater than two!") Five is greater than two! if 10 < 23: print("ten is less than twentythree!") six is less than twentythree! x='5' y='3' print(type(x)) print(type(y)) x+y <class 'str'> <class 'str'> 53 #This is a comment. print("Hello,World!") Hello,World! x = 4 # x is of type int x = "Sally" # x is now of type str print(x) Sally x=100 x="Rylex" print(x) Rylex x = str(3) # x will be '3' y = int(3) # y will be 3 z = float(3) # z will be 3.0 type(x) str x, y, z = "Orange", "Banana", "Cherry" print(x) print(y) print(z) Orange Banana Cherry a,b,c="pizza","burger","coffee" print(a) print(b) print(c) a,b,c="pizza","burger","coffee" print(a) print(b) print(c) x = "awesome" print("Python is " + x) Python is awesome x="cool" print("this lesson is "+ x) this lesson is cool def myfunc(n): return abs(n - 50) coffee = ["ice coffee", "latte", "cuppucino", "mocha", "esspresso"] newlist=list(coffee) print(newlist) ['ice coffee', 'latte', 'cuppucino', 'mocha', 'esspresso'] coffee = ["ice coffee", "latte", "cuppucino", "mocha", "esspresso"] newlist = [] for x in coffee: if "i" in x: newlist.append(x) print(newlist) ['ice coffee', 'cuppucino'] thislist = [100, 50, 65, 82, 23] thislist.sort(key = myfunc) print(thislist) [50, 65, 23, 82, 100] coffee=["mocha","cuppucino","latte","latte","american coffee","black coffee"] newlist=[] for x in coffee: if "i" in x: newlist.append(x) print(newlist) ['cuppucino', 'american coffee'] coffee=["mocha","cuppucino","latte","latte","american coffee","black coffee"] newlist=[] for x in coffee: if"o" in x: newlist.append(x) print(newlist) ['mocha', 'cuppucino', 'american coffee', 'black coffee'] Multi Words Variable Names Variable names with more than one word can be difficult to read. There are several techniques you can use to make them more readable: ![](https://i.imgur.com/abux5ty.png) my_variable_name = "John" Built-in Data Types In programming, data type is an important concept. Variables can store data of different types, and different types can do different things. Python has the following data types built-in by default, in these categories: Text Type: str Numeric Types: int, float, complex Sequence Types: list, tuple, range Mapping Type: dict Set Types: set, frozenset Boolean Type: bool Binary Types: bytes, bytearray, memoryview # 第四堂課筆記 lst=[‘a’,‘b’,‘c’,‘d’,‘e’] print(lst[2:]) [‘c’, ‘d’, ‘e’] #宣告list為一個串列,串列裏面有五個元素分別為a字串,b字串,c字串,d字串,e字串 lst=[‘a’,‘b’,‘c’,‘d’,‘e’] #把編號2的元素改爲x字串 lst[2]=‘x’ #新增一個元素為c字串 lst.append(‘c’) lst.append(‘c’) #再將b字串從串列中刪除 lst.remove(‘b’) #列印lst print(lst) lst.sort() print(lst) print(lst.count(‘c’)) [‘a’, ‘x’, ‘d’, ‘e’, ‘c’, ‘c’] [‘a’, ‘c’, ‘c’, ‘d’, ‘e’, ‘x’] 2 #宣告lst為一個串列,串列裏有幾組字串 lst=[60474,17966,96949,7521,93184,13290,80559,23407,32934,71592,53071,34576,73225,3462,78216,59119,30438,76030,79730,52719,98568,15524,58507,29695,72782,17540,20441,10752,10368,15180,22476,89952,55597,79926,68829,14250,32526,63262,61107,48936,610,57348,47497,81307,8367,23222,88503,28267,99952,23017,65085,47323,49821,32584,30972,9306,92592,61028,60358,39581,43770,94085,2831,98577,9931,58366,10600,40871,33713,1943,66767,9008,38609,50848,35469,15344,56239,86374,92828,55399,81438,35771,28739,24107,73219,89005,20861,92589,78616,96892,50728,45848,14244,8317,41248,36275,44338,26250,65693,20100,49674,12638,77506,79208,92274,25047,44884,26438,71968,27278,84019,75581,45024,47008,29499,94332,67852,46627,75689,38086,66675,55510,99517,60920,16406,87296,21488,18666,46501,7931,37377,94523,24889,28897,10315,82434,80519,29107,44336,59352,23395,73953,21217,19202,90315,48111,27022,92919,96696,22907,98326,75601,51744,78102,69792,36919,31270,23196,22309,569,94654,20295,37463,8919,99690,88852,90442,60094,69823,19703,64637,99867,39237,80980,74844,39017,18123,17988,18758,78634,3900,60379,55664,75615,95607,84908,56887,37708,58283,36994,71767,34062,55478,89828,69537,18160,35602,29494,30669,15612,52730,83730,36887,14528,59823,10236,58379,14673,51888,33971,48235,65681,17805,89998,74435,35827,78983,91095,57954,26058,66204,6975,97470,77037,47456,9607,69076,32617,26242,45940,94631,94257,45348,26917,3597,5704,69491,51613,67360,35126,93154,78994,99492,4162,63247,614,83821,33381,10056,34381,71705,74457,88928,50610,78013,41957,21557,82585,30466,39203,51609,88352,2244,34762,45872,91011,17088,6790,67257,26855,48072,48567,64293,40010,91290,3476,97079,6450,82581,91910,15534,61864,21908,65746,39500,82936,63954,88610,43249,39700,10793,66872,79996,92659,80228,9448,36590,61013,63469,26326,45445,47884,73967,21421,41899,19425,59210,36787,46378,56889,21495,43109,39921,9629,63582,19728,59478,34575,13151,3160,80212,81673,12398,29540,46928,50948,92761,86367,18091,63985,16796,75872,29856,57874,76781,92032,77341,67395,1210,26808,97008,73529,21358,65406,57923,74493,33171,21373,39342,75194,73467,69751,7697,97136,26415,70025,67578,59263,9695,75549,3704,83015,44715,6355,94385,99832,52454,83896,95925,72639,63444,94120,53960,8562,78817,28772,19604,6988,95929,95999,14315,86760,76211,23417,57539,5172,22222,22066,86309,80030,10268,68539,88993,30638,64092,25792,25528,72472,85757,28298,58715,14301,93604,40702,67783,55978,82709,73851,75038,25531,38871,17120,19271,82070,46602,91853,6345,91049,88101,15101,11779,6937,14933,74936,86133,89392,39264,3452,67439,82525,31475,48481,35519,98495,7668,84749,50908,36193,15074,9943,32107,2454,78780,17441,73188,52262,12251,26378,88538,64900,26907,21220,42911,80689,19391,90065,52189,52659,84670,88416,49692,35312,52707,38748,94510,66022,38210,46574,30275,86702,94672,6859,40450,89265,9116,18408,43824,87379,43610,87405,57130,70461,7967,81441,86876,83236,23967,58510,72518,32186,3873,70751,75079,22076,88073,8094,4970,93711,30998,20906,76629,47752,84911,31192,92113,75978,916,56421,55344,49046,6966,906,559,97913,28989,28883,6673,60028,80743,31948,71555,84297,12306,35094,66324,86015,88965,22594,46507,50596,87151,78700,68888,60814,89127,73980,58956,90709,26727,77493,7075,16224,57058,67500,66243,39027,32113,46728,60235,55317,55742,48032,55701,97697,20978,92715,37691,66691,35911,61606,82544,96662,36618,66005,44064,83106,7252,57263,90880,86945,97148,93141,7807,2158,94743,53134,52161,44451,83301,26224,67045,41691,36845,96128,56995,96052,49665,77379,21994,12101,50781,20754,31528,14421,60652,61289,87165,43245,81328,99739,67422,62196,62054,26905,64093,37926,46451,15815,62532,32190,92588,51428,59333,80126,84301,6168,35580,41369,59051,63554,53901,40095,62267,89278,16920,97229,52355,28772,6914,3501,85171,98735,76454,96349,46418,28947,541,91375,7952,44510,93425,63661,12004,57208,7070,93393,57434,42489,83896,45284,88835,29183,80434,13657,82776,1603,41967,68000,45223,96843,48292,67776,58436,99792,31665,52951,5522,99140,76258,73437,26591,61873,71810,67653,94574,79167,30600,86199,79441,56074,67194,89844,41060,20481,9736,13111,82822,99654,84090,2789,52637,36230,77089,21133,45263,54075,20490,78147,79307,94458,21291,32662,54777,77369,20061,37415,90747,3986,86743,71143,56036,30041,87021,71480,27905,74425,91619,34398,84115,29960,93170,53829,59936,32507,18886,25900,10733,50702,67533,84141,53024,79655,83924,14916,93701,24564,84376,1008,6671,33780,62350,68628,70665,12685,9513,24293,41579,56848,57664,82633,35302,46170,12039,25451,52995,68637,32448,21123,18192,60572,75160,36053,56135,66903,26351,50447,52485,43290,45181,46527,17594,64269,20066,32353,73597,85298,1735,37705,93019,93115,99872,23406,41006,26152,73624,88968,44229,11071,22834,40419,37824,19242,30767,37724,34603,44863,53402,14986,84614,22704,55032,7696,79197,90976,54602,17729,72995,88492,53301,77950,19428,29406,90649,29720,43448,17250,29641,87767,37312,78671,52406,59912,98235,97169,14969,35170,56749,71954,6300,66,74337,80048,86325,43251,60685,35196,81393,55588,29910,74193,62810,89124,51834,35790,71976,29880,33740,50152,53503,70096,37842,39555,42783,85955,66714,89907,58554,46412,35883,79642,39000,7557,90735,32707,67678,94646,71467,98581,60029,46083,20384,54084,61437,93525,29061,74883,69115,48006,72679,84083,80011,91330,93250,56278,72601,89269,78193,80427,70237,37724,60329,77822,97563,34200,10799,45878,53492,13908,21883,11098,92929,33389,5176,38927,53380,23667,57248,75461,96729,41616,23908,73188,47394,83216,15678,14966,89285,78562,18500,65491,15701,36043,29544,90224,55044,2805,55240,4076,62952,59260,35103,73696,72740,27671,56186,81530,54220,78740,18390,1788,65513,20311,25507,94132,85910,72418,32787,40910,65682,73274,91053,92856,24527,59648,9922,21190,35254,19773,20016,14120,43837,97898,5071,68705,15689,77188,45124,41379,8266,59847,72765,96880,97889,42809,7592,59273,253,52574,23282,56491,24496,94267,83905,56776,99059,5045,47520,60227,14569,71282,91760,99493,78543,96843,83285,33663,52042,44303,58556,11784] print(len(lst))#列印串列裏有幾組字串 print(max(lst))# print(min(lst)) print(sum(lst)) #宣告lst為一個串列,串列裏有幾組字串 lst=[60474,17966,96949,7521,93184,13290,80559,23407,32934,71592,53071,34576,73225,3462,78216,59119,30438,76030,79730,52719,98568,15524,58507,29695,72782,17540,20441,10752,10368,15180,22476,89952,55597,79926,68829,14250,32526,63262,61107,48936,610,57348,47497,81307,8367,23222,88503,28267,99952,23017,65085,47323,49821,32584,30972,9306,92592,61028,60358,39581,43770,94085,2831,98577,9931,58366,10600,40871,33713,1943,66767,9008,38609,50848,35469,15344,56239,86374,92828,55399,8143…952,59260,35103,73696,72740,27671,56186,81530,54220,78740,18390,1788,65513,20311,25507,94132,85910,72418,32787,40910,65682,73274,91053,92856,24527,59648,9922,21190,35254,19773,20016,14120,43837,97898,5071,68705,15689,77188,45124,41379,8266,59847,72765,96880,97889,42809,7592,59273,253,52574,23282,56491,24496,94267,83905,56776,99059,5045,47520,60227,14569,71282,91760,99493,78543,96843,83285,33663,52042,44303,58556,11784] print(len(lst))#列印串列裏有幾組字串 print(max(lst))# print(min(lst)) print(sum(lst)) 1000 99952 66 51852342 #宣告lst為一個串列,串列裏有幾組字串 lst=[‘a’,‘b’,‘c’,‘d’,‘e’] print(len(lst)) print(max(lst)) print(min(lst)) lst.sort() print(lst) 5 e a [‘a’, ‘b’, ‘c’, ‘d’, ‘e’] lst=[‘a’,‘b’,‘c’,‘d’,‘e’] print(lst[0]) print(lst[1]) print(lst[2]) print(lst[3]) print(lst[4]) a b c d e lst=[‘a’,‘b’,‘c’,‘d’,‘e’,‘f’] #針對lst中的每一個元素i (也就是説我們用i代表了每一個元素) loop 走訪串列的每個元素 #for for i in lst: print(i) lst=[‘a’,‘b’,‘c’,‘d’,‘e’,‘f’] #針對lst中的每一個元素i (也就是説我們用i代表了每一個元素) loop 走訪串列的每個元素 #for for i in lst: print(i) a b c d e f a=[1,2,3,4,5] for x in a: print(‘in for loop’) if x>3: print(x) a=[1,2,3,4,5] for x in a: print(‘in for loop’) if x>3: print(x) in for loop in for loop in for loop in for loop 4 in for loop 5 #找出串列lst中大於90000的元素 #我需要取走訪串列 #換句話説,我需要:針對串列lst的每一個元素x,找出大於90000的元素 lst=[60474,17966,96949,7521,93184,13290,80559,23407,32934,71592,53071,34576,73225,3462,78216,59119,30438,76030,79730,52719,98568,15524,58507,29695,72782,17540,20441,10752,10368,15180,22476,89952,55597,79926,68829,14250,32526,63262,61107,48936,610,57348,47497,81307,8367,23222,88503,28267,99952,23017,65085,47323,49821,32584,30972,9306,92592,61028,60358,39581,43770,94085,2831,98577,9931,58366,10600,40871,33713,1943,66767,9008,38609,50848,35469,15344,56239,86374,92828,55399,81438,35771,28739,24107,73219,89005,20861,92589,78616,96892,50728,45848,14244,8317,41248,36275,44338,26250,65693,20100,49674,12638,77506,79208,92274,25047,44884,26438,71968,27278,84019,75581,45024,47008,29499,94332,67852,46627,75689,38086,66675,55510,99517,60920,16406,87296,21488,18666,46501,7931,37377,94523,24889,28897,10315,82434,80519,29107,44336,59352,23395,73953,21217,19202,90315,48111,27022,92919,96696,22907,98326,75601,51744,78102,69792,36919,31270,23196,22309,569,94654,20295,37463,8919,99690,88852,90442,60094,69823,19703,64637,99867,39237,80980,74844,39017,18123,17988,18758,78634,3900,60379,55664,75615,95607,84908,56887,37708,58283,36994,71767,34062,55478,89828,69537,18160,35602,29494,30669,15612,52730,83730,36887,14528,59823,10236,58379,14673,51888,33971,48235,65681,17805,89998,74435,35827,78983,91095,57954,26058,66204,6975,97470,77037,47456,9607,69076,32617,26242,45940,94631,94257,45348,26917,3597,5704,69491,51613,67360,35126,93154,78994,99492,4162,63247,614,83821,33381,10056,34381,71705,74457,88928,50610,78013,41957,21557,82585,30466,39203,51609,88352,2244,34762,45872,91011,17088,6790,67257,26855,48072,48567,64293,40010,91290,3476,97079,6450,82581,91910,15534,61864,21908,65746,39500,82936,63954,88610,43249,39700,10793,66872,79996,92659,80228,9448,36590,61013,63469,26326,45445,47884,73967,21421,41899,19425,59210,36787,46378,56889,21495,43109,39921,9629,63582,19728,59478,34575,13151,3160,80212,81673,12398,29540,46928,50948,92761,86367,18091,63985,16796,75872,29856,57874,76781,92032,77341,67395,1210,26808,97008,73529,21358,65406,57923,74493,33171,21373,39342,75194,73467,69751,7697,97136,26415,70025,67578,59263,9695,75549,3704,83015,44715,6355,94385,99832,52454,83896,95925,72639,63444,94120,53960,8562,78817,28772,19604,6988,95929,95999,14315,86760,76211,23417,57539,5172,22222,22066,86309,80030,10268,68539,88993,30638,64092,25792,25528,72472,85757,28298,58715,14301,93604,40702,67783,55978,82709,73851,75038,25531,38871,17120,19271,82070,46602,91853,6345,91049,88101,15101,11779,6937,14933,74936,86133,89392,39264,3452,67439,82525,31475,48481,35519,98495,7668,84749,50908,36193,15074,9943,32107,2454,78780,17441,73188,52262,12251,26378,88538,64900,26907,21220,42911,80689,19391,90065,52189,52659,84670,88416,49692,35312,52707,38748,94510,66022,38210,46574,30275,86702,94672,6859,40450,89265,9116,18408,43824,87379,43610,87405,57130,70461,7967,81441,86876,83236,23967,58510,72518,32186,3873,70751,75079,22076,88073,8094,4970,93711,30998,20906,76629,47752,84911,31192,92113,75978,916,56421,55344,49046,6966,906,559,97913,28989,28883,6673,60028,80743,31948,71555,84297,12306,35094,66324,86015,88965,22594,46507,50596,87151,78700,68888,60814,89127,73980,58956,90709,26727,77493,7075,16224,57058,67500,66243,39027,32113,46728,60235,55317,55742,48032,55701,97697,20978,92715,37691,66691,35911,61606,82544,96662,36618,66005,44064,83106,7252,57263,90880,86945,97148,93141,7807,2158,94743,53134,52161,44451,83301,26224,67045,41691,36845,96128,56995,96052,49665,77379,21994,12101,50781,20754,31528,14421,60652,61289,87165,43245,81328,99739,67422,62196,62054,26905,64093,37926,46451,15815,62532,32190,92588,51428,59333,80126,84301,6168,35580,41369,59051,63554,53901,40095,62267,89278,16920,97229,52355,28772,6914,3501,85171,98735,76454,96349,46418,28947,541,91375,7952,44510,93425,63661,12004,57208,7070,93393,57434,42489,83896,45284,88835,29183,80434,13657,82776,1603,41967,68000,45223,96843,48292,67776,58436,99792,31665,52951,5522,99140,76258,73437,26591,61873,71810,67653,94574,79167,30600,86199,79441,56074,67194,89844,41060,20481,9736,13111,82822,99654,84090,2789,52637,36230,77089,21133,45263,54075,20490,78147,79307,94458,21291,32662,54777,77369,20061,37415,90747,3986,86743,71143,56036,30041,87021,71480,27905,74425,91619,34398,84115,29960,93170,53829,59936,32507,18886,25900,10733,50702,67533,84141,53024,79655,83924,14916,93701,24564,84376,1008,6671,33780,62350,68628,70665,12685,9513,24293,41579,56848,57664,82633,35302,46170,12039,25451,52995,68637,32448,21123,18192,60572,75160,36053,56135,66903,26351,50447,52485,43290,45181,46527,17594,64269,20066,32353,73597,85298,1735,37705,93019,93115,99872,23406,41006,26152,73624,88968,44229,11071,22834,40419,37824,19242,30767,37724,34603,44863,53402,14986,84614,22704,55032,7696,79197,90976,54602,17729,72995,88492,53301,77950,19428,29406,90649,29720,43448,17250,29641,87767,37312,78671,52406,59912,98235,97169,14969,35170,56749,71954,6300,66,74337,80048,86325,43251,60685,35196,81393,55588,29910,74193,62810,89124,51834,35790,71976,29880,33740,50152,53503,70096,37842,39555,42783,85955,66714,89907,58554,46412,35883,79642,39000,7557,90735,32707,67678,94646,71467,98581,60029,46083,20384,54084,61437,93525,29061,74883,69115,48006,72679,84083,80011,91330,93250,56278,72601,89269,78193,80427,70237,37724,60329,77822,97563,34200,10799,45878,53492,13908,21883,11098,92929,33389,5176,38927,53380,23667,57248,75461,96729,41616,23908,73188,47394,83216,15678,14966,89285,78562,18500,65491,15701,36043,29544,90224,55044,2805,55240,4076,62952,59260,35103,73696,72740,27671,56186,81530,54220,78740,18390,1788,65513,20311,25507,94132,85910,72418,32787,40910,65682,73274,91053,92856,24527,59648,9922,21190,35254,19773,20016,14120,43837,97898,5071,68705,15689,77188,45124,41379,8266,59847,72765,96880,97889,42809,7592,59273,253,52574,23282,56491,24496,94267,83905,56776,99059,5045,47520,60227,14569,71282,91760,99493,78543,96843,83285,33663,52042,44303,58556,11784] for x in lst:#針對lst的每個元素 if x>90000 and x<91000: print(“第一組”) print(x) if x>91000 and x<92000: print(“第二組”) print(x) 第一組 90315 第一組 90442 第二組 91095 第二組 91011 第二組 91290 第二組 91910 第二組 91853 第二組 91049 第一組 90065 第一組 90709 第一組 90880 第二組 91375 第一組 90747 第二組 91619 第一組 90976 第一組 90649 第一組 90735 第二組 91330 第一組 90224 第二組 91053 第二組 91760 lst=[60474,17966,96949,7521,93184,13290,80559,23407,32934,71592,53071,34576,73225,3462,78216,59119,30438,76030,79730,52719,98568,15524,58507,29695,72782,17540,20441,10752,10368,15180,22476,89952,55597,79926,68829,14250,32526,63262,61107,48936,610,57348,47497,81307,8367,23222,88503,28267,99952,23017,65085,47323,49821,32584,30972,9306,92592,61028,60358,39581,43770,94085,2831,98577,9931,58366,10600,40871,33713,1943,66767,9008,38609,50848,35469,15344,56239,86374,92828,55399,81438,35771,28739,24107,73219,89005,20861,92589,78616,96892,50728,45848,14244,8317,41248,36275,44338,26250,65693,20100,49674,12638,77506,79208,92274,25047,44884,26438,71968,27278,84019,75581,45024,47008,29499,94332,67852,46627,75689,38086,66675,55510,99517,60920,16406,87296,21488,18666,46501,7931,37377,94523,24889,28897,10315,82434,80519,29107,44336,59352,23395,73953,21217,19202,90315,48111,27022,92919,96696,22907,98326,75601,51744,78102,69792,36919,31270,23196,22309,569,94654,20295,37463,8919,99690,88852,90442,60094,69823,19703,64637,99867,39237,80980,74844,39017,18123,17988,18758,78634,3900,60379,55664,75615,95607,84908,56887,37708,58283,36994,71767,34062,55478,89828,69537,18160,35602,29494,30669,15612,52730,83730,36887,14528,59823,10236,58379,14673,51888,33971,48235,65681,17805,89998,74435,35827,78983,91095,57954,26058,66204,6975,97470,77037,47456,9607,69076,32617,26242,45940,94631,94257,45348,26917,3597,5704,69491,51613,67360,35126,93154,78994,99492,4162,63247,614,83821,33381,10056,34381,71705,74457,88928,50610,78013,41957,21557,82585,30466,39203,51609,88352,2244,34762,45872,91011,17088,6790,67257,26855,48072,48567,64293,40010,91290,3476,97079,6450,82581,91910,15534,61864,21908,65746,39500,82936,63954,88610,43249,39700,10793,66872,79996,92659,80228,9448,36590,61013,63469,26326,45445,47884,73967,21421,41899,19425,59210,36787,46378,56889,21495,43109,39921,9629,63582,19728,59478,34575,13151,3160,80212,81673,12398,29540,46928,50948,92761,86367,18091,63985,16796,75872,29856,57874,76781,92032,77341,67395,1210,26808,97008,73529,21358,65406,57923,74493,33171,21373,39342,75194,73467,69751,7697,97136,26415,70025,67578,59263,9695,75549,3704,83015,44715,6355,94385,99832,52454,83896,95925,72639,63444,94120,53960,8562,78817,28772,19604,6988,95929,95999,14315,86760,76211,23417,57539,5172,22222,22066,86309,80030,10268,68539,88993,30638,64092,25792,25528,72472,85757,28298,58715,14301,93604,40702,67783,55978,82709,73851,75038,25531,38871,17120,19271,82070,46602,91853,6345,91049,88101,15101,11779,6937,14933,74936,86133,89392,39264,3452,67439,82525,31475,48481,35519,98495,7668,84749,50908,36193,15074,9943,32107,2454,78780,17441,73188,52262,12251,26378,88538,64900,26907,21220,42911,80689,19391,90065,52189,52659,84670,88416,49692,35312,52707,38748,94510,66022,38210,46574,30275,86702,94672,6859,40450,89265,9116,18408,43824,87379,43610,87405,57130,70461,7967,81441,86876,83236,23967,58510,72518,32186,3873,70751,75079,22076,88073,8094,4970,93711,30998,20906,76629,47752,84911,31192,92113,75978,916,56421,55344,49046,6966,906,559,97913,28989,28883,6673,60028,80743,31948,71555,84297,12306,35094,66324,86015,88965,22594,46507,50596,87151,78700,68888,60814,89127,73980,58956,90709,26727,77493,7075,16224,57058,67500,66243,39027,32113,46728,60235,55317,55742,48032,55701,97697,20978,92715,37691,66691,35911,61606,82544,96662,36618,66005,44064,83106,7252,57263,90880,86945,97148,93141,7807,2158,94743,53134,52161,44451,83301,26224,67045,41691,36845,96128,56995,96052,49665,77379,21994,12101,50781,20754,31528,14421,60652,61289,87165,43245,81328,99739,67422,62196,62054,26905,64093,37926,46451,15815,62532,32190,92588,51428,59333,80126,84301,6168,35580,41369,59051,63554,53901,40095,62267,89278,16920,97229,52355,28772,6914,3501,85171,98735,76454,96349,46418,28947,541,91375,7952,44510,93425,63661,12004,57208,7070,93393,57434,42489,83896,45284,88835,29183,80434,13657,82776,1603,41967,68000,45223,96843,48292,67776,58436,99792,31665,52951,5522,99140,76258,73437,26591,61873,71810,67653,94574,79167,30600,86199,79441,56074,67194,89844,41060,20481,9736,13111,82822,99654,84090,2789,52637,36230,77089,21133,45263,54075,20490,78147,79307,94458,21291,32662,54777,77369,20061,37415,90747,3986,86743,71143,56036,30041,87021,71480,27905,74425,91619,34398,84115,29960,93170,53829,59936,32507,18886,25900,10733,50702,67533,84141,53024,79655,83924,14916,93701,24564,84376,1008,6671,33780,62350,68628,70665,12685,9513,24293,41579,56848,57664,82633,35302,46170,12039,25451,52995,68637,32448,21123,18192,60572,75160,36053,56135,66903,26351,50447,52485,43290,45181,46527,17594,64269,20066,32353,73597,85298,1735,37705,93019,93115,99872,23406,41006,26152,73624,88968,44229,11071,22834,40419,37824,19242,30767,37724,34603,44863,53402,14986,84614,22704,55032,7696,79197,90976,54602,17729,72995,88492,53301,77950,19428,29406,90649,29720,43448,17250,29641,87767,37312,78671,52406,59912,98235,97169,14969,35170,56749,71954,6300,66,74337,80048,86325,43251,60685,35196,81393,55588,29910,74193,62810,89124,51834,35790,71976,29880,33740,50152,53503,70096,37842,39555,42783,85955,66714,89907,58554,46412,35883,79642,39000,7557,90735,32707,67678,94646,71467,98581,60029,46083,20384,54084,61437,93525,29061,74883,69115,48006,72679,84083,80011,91330,93250,56278,72601,89269,78193,80427,70237,37724,60329,77822,97563,34200,10799,45878,53492,13908,21883,11098,92929,33389,5176,38927,53380,23667,57248,75461,96729,41616,23908,73188,47394,83216,15678,14966,89285,78562,18500,65491,15701,36043,29544,90224,55044,2805,55240,4076,62952,59260,35103,73696,72740,27671,56186,81530,54220,78740,18390,1788,65513,20311,25507,94132,85910,72418,32787,40910,65682,73274,91053,92856,24527,59648,9922,21190,35254,19773,20016,14120,43837,97898,5071,68705,15689,77188,45124,41379,8266,59847,72765,96880,97889,42809,7592,59273,253,52574,23282,56491,24496,94267,83905,56776,99059,5045,47520,60227,14569,71282,91760,99493,78543,96843,83285,33663,52042,44303,58556,11784] for x in lst: if x>1 and x<10000: print(x) 7521 3462 610 8367 9306 2831 9931 1943 9008 8317 7931 569 8919 3900 6975 9607 3597 5704 4162 614 2244 6790 3476 6450 9448 9629 3160 1210 7697 9695 3704 6355 8562 6988 5172 6345 6937 3452 7668 9943 2454 6859 9116 7967 3873 8094 4970 916 6966 906 559 6673 7075 7252 7807 2158 6168 6914 3501 541 7952 7070 1603 5522 9736 2789 3986 1008 6671 9513 1735 7696 6300 66 7557 5176 2805 4076 1788 9922 5071 8266 7592 253 5045 a=[1,2,3,4,5] b=0 for x in a: b=b+x print(b) 15 a=[1,2,3,4,5] b=0 for x in a: print(‘x=’) print(x) b=b+x print(‘b=’) print(b) print(“========”) print(b) x= 1 b= 1 x= 2 b= 3 x= 3 b= 6 x= 4 b= 10 x= 5 b= 15 a=[60474,17966,96949,7521,93184,13290,80559,23407,32934,71592,53071,34576,73225,3462,78216,59119,30438,76030,79730,52719,98568,15524,58507,29695,72782,17540,20441,10752,10368,15180,22476,89952,55597,79926,68829,14250,32526,63262,61107,48936,610,57348,47497,81307,8367,23222,88503,28267,99952,23017,65085,47323,49821,32584,30972,9306,92592,61028,60358,39581,43770,94085,2831,98577,9931,58366,10600,40871,33713,1943,66767,9008,38609,50848,35469,15344,56239,86374,92828,55399,81438,35771,28739,24107,73219,89005,20861,92589,78616,96892,50728,45848,14244,8317,41248,36275,44338,26250,65693,20100,49674,12638,77506,79208,92274,25047,44884,26438,71968,27278,84019,75581,45024,47008,29499,94332,67852,46627,75689,38086,66675,55510,99517,60920,16406,87296,21488,18666,46501,7931,37377,94523,24889,28897,10315,82434,80519,29107,44336,59352,23395,73953,21217,19202,90315,48111,27022,92919,96696,22907,98326,75601,51744,78102,69792,36919,31270,23196,22309,569,94654,20295,37463,8919,99690,88852,90442,60094,69823,19703,64637,99867,39237,80980,74844,39017,18123,17988,18758,78634,3900,60379,55664,75615,95607,84908,56887,37708,58283,36994,71767,34062,55478,89828,69537,18160,35602,29494,30669,15612,52730,83730,36887,14528,59823,10236,58379,14673,51888,33971,48235,65681,17805,89998,74435,35827,78983,91095,57954,26058,66204,6975,97470,77037,47456,9607,69076,32617,26242,45940,94631,94257,45348,26917,3597,5704,69491,51613,67360,35126,93154,78994,99492,4162,63247,614,83821,33381,10056,34381,71705,74457,88928,50610,78013,41957,21557,82585,30466,39203,51609,88352,2244,34762,45872,91011,17088,6790,67257,26855,48072,48567,64293,40010,91290,3476,97079,6450,82581,91910,15534,61864,21908,65746,39500,82936,63954,88610,43249,39700,10793,66872,79996,92659,80228,9448,36590,61013,63469,26326,45445,47884,73967,21421,41899,19425,59210,36787,46378,56889,21495,43109,39921,9629,63582,19728,59478,34575,13151,3160,80212,81673,12398,29540,46928,50948,92761,86367,18091,63985,16796,75872,29856,57874,76781,92032,77341,67395,1210,26808,97008,73529,21358,65406,57923,74493,33171,21373,39342,75194,73467,69751,7697,97136,26415,70025,67578,59263,9695,75549,3704,83015,44715,6355,94385,99832,52454,83896,95925,72639,63444,94120,53960,8562,78817,28772,19604,6988,95929,95999,14315,86760,76211,23417,57539,5172,22222,22066,86309,80030,10268,68539,88993,30638,64092,25792,25528,72472,85757,28298,58715,14301,93604,40702,67783,55978,82709,73851,75038,25531,38871,17120,19271,82070,46602,91853,6345,91049,88101,15101,11779,6937,14933,74936,86133,89392,39264,3452,67439,82525,31475,48481,35519,98495,7668,84749,50908,36193,15074,9943,32107,2454,78780,17441,73188,52262,12251,26378,88538,64900,26907,21220,42911,80689,19391,90065,52189,52659,84670,88416,49692,35312,52707,38748,94510,66022,38210,46574,30275,86702,94672,6859,40450,89265,9116,18408,43824,87379,43610,87405,57130,70461,7967,81441,86876,83236,23967,58510,72518,32186,3873,70751,75079,22076,88073,8094,4970,93711,30998,20906,76629,47752,84911,31192,92113,75978,916,56421,55344,49046,6966,906,559,97913,28989,28883,6673,60028,80743,31948,71555,84297,12306,35094,66324,86015,88965,22594,46507,50596,87151,78700,68888,60814,89127,73980,58956,90709,26727,77493,7075,16224,57058,67500,66243,39027,32113,46728,60235,55317,55742,48032,55701,97697,20978,92715,37691,66691,35911,61606,82544,96662,36618,66005,44064,83106,7252,57263,90880,86945,97148,93141,7807,2158,94743,53134,52161,44451,83301,26224,67045,41691,36845,96128,56995,96052,49665,77379,21994,12101,50781,20754,31528,14421,60652,61289,87165,43245,81328,99739,67422,62196,62054,26905,64093,37926,46451,15815,62532,32190,92588,51428,59333,80126,84301,6168,35580,41369,59051,63554,53901,40095,62267,89278,16920,97229,52355,28772,6914,3501,85171,98735,76454,96349,46418,28947,541,91375,7952,44510,93425,63661,12004,57208,7070,93393,57434,42489,83896,45284,88835,29183,80434,13657,82776,1603,41967,68000,45223,96843,48292,67776,58436,99792,31665,52951,5522,99140,76258,73437,26591,61873,71810,67653,94574,79167,30600,86199,79441,56074,67194,89844,41060,20481,9736,13111,82822,99654,84090,2789,52637,36230,77089,21133,45263,54075,20490,78147,79307,94458,21291,32662,54777,77369,20061,37415,90747,3986,86743,71143,56036,30041,87021,71480,27905,74425,91619,34398,84115,29960,93170,53829,59936,32507,18886,25900,10733,50702,67533,84141,53024,79655,83924,14916,93701,24564,84376,1008,6671,33780,62350,68628,70665,12685,9513,24293,41579,56848,57664,82633,35302,46170,12039,25451,52995,68637,32448,21123,18192,60572,75160,36053,56135,66903,26351,50447,52485,43290,45181,46527,17594,64269,20066,32353,73597,85298,1735,37705,93019,93115,99872,23406,41006,26152,73624,88968,44229,11071,22834,40419,37824,19242,30767,37724,34603,44863,53402,14986,84614,22704,55032,7696,79197,90976,54602,17729,72995,88492,53301,77950,19428,29406,90649,29720,43448,17250,29641,87767,37312,78671,52406,59912,98235,97169,14969,35170,56749,71954,6300,66,74337,80048,86325,43251,60685,35196,81393,55588,29910,74193,62810,89124,51834,35790,71976,29880,33740,50152,53503,70096,37842,39555,42783,85955,66714,89907,58554,46412,35883,79642,39000,7557,90735,32707,67678,94646,71467,98581,60029,46083,20384,54084,61437,93525,29061,74883,69115,48006,72679,84083,80011,91330,93250,56278,72601,89269,78193,80427,70237,37724,60329,77822,97563,34200,10799,45878,53492,13908,21883,11098,92929,33389,5176,38927,53380,23667,57248,75461,96729,41616,23908,73188,47394,83216,15678,14966,89285,78562,18500,65491,15701,36043,29544,90224,55044,2805,55240,4076,62952,59260,35103,73696,72740,27671,56186,81530,54220,78740,18390,1788,65513,20311,25507,94132,85910,72418,32787,40910,65682,73274,91053,92856,24527,59648,9922,21190,35254,19773,20016,14120,43837,97898,5071,68705,15689,77188,45124,41379,8266,59847,72765,96880,97889,42809,7592,59273,253,52574,23282,56491,24496,94267,83905,56776,99059,5045,47520,60227,14569,71282,91760,99493,78543,96843,83285,33663,52042,44303,58556,11784] b=0 for x in a: print(‘x=’) print(x) b=b+x print(‘b=’) print(b) print(‘=========’) x= 11784 b= 51852342 a=[1,3,2,4,5] b=0 for x in a: print(‘x=’) print(x) if x>b: b=x print(‘b=’) print(b) print(‘========’) max(a) x= 1 b= 1 x= 3 b= 3 x= 2 x= 4 b= 4 x= 5 b= 5 5 a=[60474,17966,96949,7521,93184,13290,80559,23407,32934,71592,53071,34576,73225,3462,78216,59119,30438,76030,79730,52719,98568,15524,58507,29695,72782,17540,20441,10752,10368,15180,22476,89952,55597,79926,68829,14250,32526,63262,61107,48936,610,57348,47497,81307,8367,23222,88503,28267,99952,23017,65085,47323,49821,32584,30972,9306,92592,61028,60358,39581,43770,94085,2831,98577,9931,58366,10600,40871,33713,1943,66767,9008,38609,50848,35469,15344,56239,86374,92828,55399,81438,35771,28739,24107,73219,89005,20861,92589,78616,96892,50728,45848,14244,8317,41248,36275,44338,26250,65693,20100,49674,12638,77506,79208,92274,25047,44884,26438,71968,27278,84019,75581,45024,47008,29499,94332,67852,46627,75689,38086,66675,55510,99517,60920,16406,87296,21488,18666,46501,7931,37377,94523,24889,28897,10315,82434,80519,29107,44336,59352,23395,73953,21217,19202,90315,48111,27022,92919,96696,22907,98326,75601,51744,78102,69792,36919,31270,23196,22309,569,94654,20295,37463,8919,99690,88852,90442,60094,69823,19703,64637,99867,39237,80980,74844,39017,18123,17988,18758,78634,3900,60379,55664,75615,95607,84908,56887,37708,58283,36994,71767,34062,55478,89828,69537,18160,35602,29494,30669,15612,52730,83730,36887,14528,59823,10236,58379,14673,51888,33971,48235,65681,17805,89998,74435,35827,78983,91095,57954,26058,66204,6975,97470,77037,47456,9607,69076,32617,26242,45940,94631,94257,45348,26917,3597,5704,69491,51613,67360,35126,93154,78994,99492,4162,63247,614,83821,33381,10056,34381,71705,74457,88928,50610,78013,41957,21557,82585,30466,39203,51609,88352,2244,34762,45872,91011,17088,6790,67257,26855,48072,48567,64293,40010,91290,3476,97079,6450,82581,91910,15534,61864,21908,65746,39500,82936,63954,88610,43249,39700,10793,66872,79996,92659,80228,9448,36590,61013,63469,26326,45445,47884,73967,21421,41899,19425,59210,36787,46378,56889,21495,43109,39921,9629,63582,19728,59478,34575,13151,3160,80212,81673,12398,29540,46928,50948,92761,86367,18091,63985,16796,75872,29856,57874,76781,92032,77341,67395,1210,26808,97008,73529,21358,65406,57923,74493,33171,21373,39342,75194,73467,69751,7697,97136,26415,70025,67578,59263,9695,75549,3704,83015,44715,6355,94385,99832,52454,83896,95925,72639,63444,94120,53960,8562,78817,28772,19604,6988,95929,95999,14315,86760,76211,23417,57539,5172,22222,22066,86309,80030,10268,68539,88993,30638,64092,25792,25528,72472,85757,28298,58715,14301,93604,40702,67783,55978,82709,73851,75038,25531,38871,17120,19271,82070,46602,91853,6345,91049,88101,15101,11779,6937,14933,74936,86133,89392,39264,3452,67439,82525,31475,48481,35519,98495,7668,84749,50908,36193,15074,9943,32107,2454,78780,17441,73188,52262,12251,26378,88538,64900,26907,21220,42911,80689,19391,90065,52189,52659,84670,88416,49692,35312,52707,38748,94510,66022,38210,46574,30275,86702,94672,6859,40450,89265,9116,18408,43824,87379,43610,87405,57130,70461,7967,81441,86876,83236,23967,58510,72518,32186,3873,70751,75079,22076,88073,8094,4970,93711,30998,20906,76629,47752,84911,31192,92113,75978,916,56421,55344,49046,6966,906,559,97913,28989,28883,6673,60028,80743,31948,71555,84297,12306,35094,66324,86015,88965,22594,46507,50596,87151,78700,68888,60814,89127,73980,58956,90709,26727,77493,7075,16224,57058,67500,66243,39027,32113,46728,60235,55317,55742,48032,55701,97697,20978,92715,37691,66691,35911,61606,82544,96662,36618,66005,44064,83106,7252,57263,90880,86945,97148,93141,7807,2158,94743,53134,52161,44451,83301,26224,67045,41691,36845,96128,56995,96052,49665,77379,21994,12101,50781,20754,31528,14421,60652,61289,87165,43245,81328,99739,67422,62196,62054,26905,64093,37926,46451,15815,62532,32190,92588,51428,59333,80126,84301,6168,35580,41369,59051,63554,53901,40095,62267,89278,16920,97229,52355,28772,6914,3501,85171,98735,76454,96349,46418,28947,541,91375,7952,44510,93425,63661,12004,57208,7070,93393,57434,42489,83896,45284,88835,29183,80434,13657,82776,1603,41967,68000,45223,96843,48292,67776,58436,99792,31665,52951,5522,99140,76258,73437,26591,61873,71810,67653,94574,79167,30600,86199,79441,56074,67194,89844,41060,20481,9736,13111,82822,99654,84090,2789,52637,36230,77089,21133,45263,54075,20490,78147,79307,94458,21291,32662,54777,77369,20061,37415,90747,3986,86743,71143,56036,30041,87021,71480,27905,74425,91619,34398,84115,29960,93170,53829,59936,32507,18886,25900,10733,50702,67533,84141,53024,79655,83924,14916,93701,24564,84376,1008,6671,33780,62350,68628,70665,12685,9513,24293,41579,56848,57664,82633,35302,46170,12039,25451,52995,68637,32448,21123,18192,60572,75160,36053,56135,66903,26351,50447,52485,43290,45181,46527,17594,64269,20066,32353,73597,85298,1735,37705,93019,93115,99872,23406,41006,26152,73624,88968,44229,11071,22834,40419,37824,19242,30767,37724,34603,44863,53402,14986,84614,22704,55032,7696,79197,90976,54602,17729,72995,88492,53301,77950,19428,29406,90649,29720,43448,17250,29641,87767,37312,78671,52406,59912,98235,97169,14969,35170,56749,71954,6300,66,74337,80048,86325,43251,60685,35196,81393,55588,29910,74193,62810,89124,51834,35790,71976,29880,33740,50152,53503,70096,37842,39555,42783,85955,66714,89907,58554,46412,35883,79642,39000,7557,90735,32707,67678,94646,71467,98581,60029,46083,20384,54084,61437,93525,29061,74883,69115,48006,72679,84083,80011,91330,93250,56278,72601,89269,78193,80427,70237,37724,60329,77822,97563,34200,10799,45878,53492,13908,21883,11098,92929,33389,5176,38927,53380,23667,57248,75461,96729,41616,23908,73188,47394,83216,15678,14966,89285,78562,18500,65491,15701,36043,29544,90224,55044,2805,55240,4076,62952,59260,35103,73696,72740,27671,56186,81530,54220,78740,18390,1788,65513,20311,25507,94132,85910,72418,32787,40910,65682,73274,91053,92856,24527,59648,9922,21190,35254,19773,20016,14120,43837,97898,5071,68705,15689,77188,45124,41379,8266,59847,72765,96880,97889,42809,7592,59273,253,52574,23282,56491,24496,94267,83905,56776,99059,5045,47520,60227,14569,71282,91760,99493,78543,96843,83285,33663,52042,44303,58556,11784] b=0 for x in a: print(‘x=’) print(x) if x>b: b=x print(‘b=’) print(b) print(‘========’) x= 11784 import numpy as np import matplotlib.pyplot as plt a=[1,2,3,4,5,6,7] b=[1,2,3,4,5,6,7] plt.scatter(x=a,y=b,s=5) plt.axis(‘square’) plt.xlim(0,10) plt.ylim(0,10) print(f’我的圖形’) plt.show() 我的圖形 # 第五堂程式設計筆記 x=[2,4,6,8,10] for a in x: print(a) 2 4 6 8 10 lst=[60474,17966,96949,7521,93184,13290,80559,23407,32934,71592,53071,34576,73225,3462,78216,59119,30438,76030,79730,52719,98568,15524,58507,29695,72782,17540,20441,10752,10368,15180,22476,89952,55597,79926,68829,14250,32526,63262,61107,48936,610,57348,47497,81307,8367,23222,88503,28267,99952,23017,65085,47323,49821,32584,30972,9306,92592,61028,60358,39581,43770,94085,2831,98577,9931,58366,10600,40871,33713,1943,66767,9008,38609,50848,35469,15344,56239,86374,92828,55399,81438,35771,28739,24107,73219,89005,20861,92589,78616,96892,50728,45848,14244,8317,41248,36275,44338,26250,65693,20100,49674,12638,77506,79208,92274,25047,44884,26438,71968,27278,84019,75581,45024,47008,29499,94332,67852,46627,75689,38086,66675,55510,99517,60920,16406,87296,21488,18666,46501,7931,37377,94523,24889,28897,10315,82434,80519,29107,44336,59352,23395,73953,21217,19202,90315,48111,27022,92919,96696,22907,98326,75601,51744,78102,69792,36919,31270,23196,22309,569,94654,20295,37463,8919,99690,88852,90442,60094,69823,19703,64637,99867,39237,80980,74844,39017,18123,17988,18758,78634,3900,60379,55664,75615,95607,84908,56887,37708,58283,36994,71767,34062,55478,89828,69537,18160,35602,29494,30669,15612,52730,83730,36887,14528,59823,10236,58379,14673,51888,33971,48235,65681,17805,89998,74435,35827,78983,91095,57954,26058,66204,6975,97470,77037,47456,9607,69076,32617,26242,45940,94631,94257,45348,26917,3597,5704,69491,51613,67360,35126,93154,78994,99492,4162,63247,614,83821,33381,10056,34381,71705,74457,88928,50610,78013,41957,21557,82585,30466,39203,51609,88352,2244,34762,45872,91011,17088,6790,67257,26855,48072,48567,64293,40010,91290,3476,97079,6450,82581,91910,15534,61864,21908,65746,39500,82936,63954,88610,43249,39700,10793,66872,79996,92659,80228,9448,36590,61013,63469,26326,45445,47884,73967,21421,41899,19425,59210,36787,46378,56889,21495,43109,39921,9629,63582,19728,59478,34575,13151,3160,80212,81673,12398,29540,46928,50948,92761,86367,18091,63985,16796,75872,29856,57874,76781,92032,77341,67395,1210,26808,97008,73529,21358,65406,57923,74493,33171,21373,39342,75194,73467,69751,7697,97136,26415,70025,67578,59263,9695,75549,3704,83015,44715,6355,94385,99832,52454,83896,95925,72639,63444,94120,53960,8562,78817,28772,19604,6988,95929,95999,14315,86760,76211,23417,57539,5172,22222,22066,86309,80030,10268,68539,88993,30638,64092,25792,25528,72472,85757,28298,58715,14301,93604,40702,67783,55978,82709,73851,75038,25531,38871,17120,19271,82070,46602,91853,6345,91049,88101,15101,11779,6937,14933,74936,86133,89392,39264,3452,67439,82525,31475,48481,35519,98495,7668,84749,50908,36193,15074,9943,32107,2454,78780,17441,73188,52262,12251,26378,88538,64900,26907,21220,42911,80689,19391,90065,52189,52659,84670,88416,49692,35312,52707,38748,94510,66022,38210,46574,30275,86702,94672,6859,40450,89265,9116,18408,43824,87379,43610,87405,57130,70461,7967,81441,86876,83236,23967,58510,72518,32186,3873,70751,75079,22076,88073,8094,4970,93711,30998,20906,76629,47752,84911,31192,92113,75978,916,56421,55344,49046,6966,906,559,97913,28989,28883,6673,60028,80743,31948,71555,84297,12306,35094,66324,86015,88965,22594,46507,50596,87151,78700,68888,60814,89127,73980,58956,90709,26727,77493,7075,16224,57058,67500,66243,39027,32113,46728,60235,55317,55742,48032,55701,97697,20978,92715,37691,66691,35911,61606,82544,96662,36618,66005,44064,83106,7252,57263,90880,86945,97148,93141,7807,2158,94743,53134,52161,44451,83301,26224,67045,41691,36845,96128,56995,96052,49665,77379,21994,12101,50781,20754,31528,14421,60652,61289,87165,43245,81328,99739,67422,62196,62054,26905,64093,37926,46451,15815,62532,32190,92588,51428,59333,80126,84301,6168,35580,41369,59051,63554,53901,40095,62267,89278,16920,97229,52355,28772,6914,3501,85171,98735,76454,96349,46418,28947,541,91375,7952,44510,93425,63661,12004,57208,7070,93393,57434,42489,83896,45284,88835,29183,80434,13657,82776,1603,41967,68000,45223,96843,48292,67776,58436,99792,31665,52951,5522,99140,76258,73437,26591,61873,71810,67653,94574,79167,30600,86199,79441,56074,67194,89844,41060,20481,9736,13111,82822,99654,84090,2789,52637,36230,77089,21133,45263,54075,20490,78147,79307,94458,21291,32662,54777,77369,20061,37415,90747,3986,86743,71143,56036,30041,87021,71480,27905,74425,91619,34398,84115,29960,93170,53829,59936,32507,18886,25900,10733,50702,67533,84141,53024,79655,83924,14916,93701,24564,84376,1008,6671,33780,62350,68628,70665,12685,9513,24293,41579,56848,57664,82633,35302,46170,12039,25451,52995,68637,32448,21123,18192,60572,75160,36053,56135,66903,26351,50447,52485,43290,45181,46527,17594,64269,20066,32353,73597,85298,1735,37705,93019,93115,99872,23406,41006,26152,73624,88968,44229,11071,22834,40419,37824,19242,30767,37724,34603,44863,53402,14986,84614,22704,55032,7696,79197,90976,54602,17729,72995,88492,53301,77950,19428,29406,90649,29720,43448,17250,29641,87767,37312,78671,52406,59912,98235,97169,14969,35170,56749,71954,6300,66,74337,80048,86325,43251,60685,35196,81393,55588,29910,74193,62810,89124,51834,35790,71976,29880,33740,50152,53503,70096,37842,39555,42783,85955,66714,89907,58554,46412,35883,79642,39000,7557,90735,32707,67678,94646,71467,98581,60029,46083,20384,54084,61437,93525,29061,74883,69115,48006,72679,84083,80011,91330,93250,56278,72601,89269,78193,80427,70237,37724,60329,77822,97563,34200,10799,45878,53492,13908,21883,11098,92929,33389,5176,38927,53380,23667,57248,75461,96729,41616,23908,73188,47394,83216,15678,14966,89285,78562,18500,65491,15701,36043,29544,90224,55044,2805,55240,4076,62952,59260,35103,73696,72740,27671,56186,81530,54220,78740,18390,1788,65513,20311,25507,94132,85910,72418,32787,40910,65682,73274,91053,92856,24527,59648,9922,21190,35254,19773,20016,14120,43837,97898,5071,68705,15689,77188,45124,41379,8266,59847,72765,96880,97889,42809,7592,59273,253,52574,23282,56491,24496,94267,83905,56776,99059,5045,47520,60227,14569,71282,91760,99493,78543,96843,83285,33663,52042,44303,58556,11784] a=0 for x in lst: a=x+a b=0 for x in lst: if x>b: b=x print(b) 51852342 99952 A=[3,5,7,4,6] y=0 z=0 for x in A: y=y+x if x>z: z=x print(x) print(y) print(z) 6 25 7 a=[3,5,7,2] y=0 z=0 for x in a: z=z+x print(x) print(y) print(z) print(a) 2 0 17 [3, 5, 7, 2] ![](https://i.imgur.com/i9Vmqyh.png) # 第六堂程式設計筆記 >>> from matplotlib import cm >>> from mpl_toolkits.mplot3d import Axes3D >>> import matplotlib.pyplot as plt >>> import numpy as np >>> fig = plt.figure() >>> ax = fig.gca(projection='3d') >>> X = np.arange(-5, 5, 0.25) >>> Y = np.arange(-5, 5, 0.25) >>> X, Y = np.meshgrid(X, Y) >>> R = np.sqrt(X**2 + Y**2) >>> Z = np.sin(R) >>> surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.coolwarm) >>> plt.show() ![](https://i.imgur.com/US0Q6KA.png) ![](https://i.imgur.com/EHfkyn7.png) dict = { "109213504":"麥禮仁", "110211049":"稅正祺", "110211003":"林志宬", "110251009":"王博賢", "110211026":"洪權佑", "110211012":"黃玉柔", "110211028":"陳宜樺", "110211016":"林依嫻", "110251027":"郭姉祐", "110251001":"董哲安", "110251002":"高證鎰", "110251049":"陳昱慈", "110251016":"王麗婷", "110251014":"謝欣伶", "110251044":"王之賢", "110211050":"江柏逸", "110211005":"陳禹侖", "110211018":"楊凡寬", "110211027":"林昌興", "110211047":"趙梓豐", "110211008":"周芃君", "110211004":"鍾孝歆", "110211025":"黃巧瓈", "110251008":"陳韋蓁", "110251010":"劉姸希", "110251050":"鄭捷方", "106213050":"朱昱丞", "110211040":"陳亨毓", "110251039":"黃凱葶", "110251035":"溫嘉泓", "110211052":"林世鎧", "110211034":"洪橞䈶", "110251043":"許家維", "110251040":"陳柔云", "110211013":"顏庭茂", "110251041":"魏敏如", "110251037":"蔣水晶", "110211046":"何思雅", "110211002":"王敏甄", "110251018":"李佳臻", "110211058":"鄭宜蓁", "110211030":"劉昱岑", "110211060":"吳宜軒", "110251030":"溫瑩瑄", "110211009":"李佳蓁", "110211037":"粘伊萱", "110211041":"戚佩琳", "110251029":"廖韋茹", "110211062":"王郁亨", "109211067":"古宇立", "108251026":"許詠翔", "110251020":"王雅蓁", "110251017":"韓育欣", "110251023":"陳懷恩", "110211032":"郭芝榛", "110211051":"林秉楓", "110251021":"潘妘昕", "110251019":"林益任", "110251051":"王方琦", "110251028":"傅翊安", "110211014":"陳柏勳", "110251003":"陳千晴", "110251004":"翟品荃", "110251013":"江羽晴", "110251012":"陳玟伃", "110251005":"陳品蓉", "110251026":"王愉盛", "110211031":"江以薰", "110211022":"吳姿儀", "110211007":"譚厚誼", "110211053":"廖振羽", "109251040":"傅善鉑", "110211036":"葉平超", "110211024":"蕭逸韋", "110211029":"張彥程", "110211061":"陳柏揚", "110211023":"薛皓均", "110211015":"吳玗苀", "110251015":"吳依蓁", "110251032":"黃元泓", "110251045":"劉冠伯", "110211011":"黃翊喆", "110211055":"吳耀登", "110251006":"陳薏如", "110251038":"周宗永", "110211063":"陳玉珊", "110251011":"趙奕媗", "110211033":"蘇家陞", "110251024":"邱亮云", "110251047":"盧承徵", "109105031":"簡志安", "109105030":"陳柏揚" } for x in dict: print(x) for x in dict.values(): print(x) for x, y in dict.items(): print(x, y) 109213504 110211049 110211003 110251009 110211026 110211012 110211028 110211016 110251027 110251001 110251002 110251049 110251016 110251014 110251044 110211050 110211005 110211018 110211027 110211047 110211008 110211004 110211025 110251008 110251010 110251050 106213050 110211040 110251039 110251035 110211052 110211034 110251043 110251040 110211013 110251041 110251037 110211046 110211002 110251018 110211058 110211030 110211060 110251030 110211009 110211037 110211041 110251029 110211062 109211067 108251026 110251020 110251017 110251023 110211032 110211051 110251021 110251019 110251051 110251028 110211014 110251003 110251004 110251013 110251012 110251005 110251026 110211031 110211022 110211007 110211053 109251040 110211036 110211024 110211029 110211061 110211023 110211015 110251015 110251032 110251045 110211011 110211055 110251006 110251038 110211063 110251011 110211033 110251024 110251047 109105031 109105030 麥禮仁 稅正祺 林志宬 王博賢 洪權佑 黃玉柔 陳宜樺 林依嫻 郭姉祐 董哲安 高證鎰 陳昱慈 王麗婷 謝欣伶 王之賢 江柏逸 陳禹侖 楊凡寬 林昌興 趙梓豐 周芃君 鍾孝歆 黃巧瓈 陳韋蓁 劉姸希 鄭捷方 朱昱丞 陳亨毓 黃凱葶 溫嘉泓 林世鎧 洪橞䈶 許家維 陳柔云 顏庭茂 魏敏如 蔣水晶 何思雅 王敏甄 李佳臻 鄭宜蓁 劉昱岑 吳宜軒 溫瑩瑄 李佳蓁 粘伊萱 戚佩琳 廖韋茹 王郁亨 古宇立 許詠翔 王雅蓁 韓育欣 陳懷恩 郭芝榛 林秉楓 潘妘昕 林益任 王方琦 傅翊安 陳柏勳 陳千晴 翟品荃 江羽晴 陳玟伃 陳品蓉 王愉盛 江以薰 吳姿儀 譚厚誼 廖振羽 傅善鉑 葉平超 蕭逸韋 張彥程 陳柏揚 薛皓均 吳玗苀 吳依蓁 黃元泓 劉冠伯 黃翊喆 吳耀登 陳薏如 周宗永 陳玉珊 趙奕媗 蘇家陞 邱亮云 盧承徵 簡志安 陳柏揚 109213504 麥禮仁 110211049 稅正祺 110211003 林志宬 110251009 王博賢 110211026 洪權佑 110211012 黃玉柔 110211028 陳宜樺 110211016 林依嫻 110251027 郭姉祐 110251001 董哲安 110251002 高證鎰 110251049 陳昱慈 110251016 王麗婷 110251014 謝欣伶 110251044 王之賢 110211050 江柏逸 110211005 陳禹侖 110211018 楊凡寬 110211027 林昌興 110211047 趙梓豐 110211008 周芃君 110211004 鍾孝歆 110211025 黃巧瓈 110251008 陳韋蓁 110251010 劉姸希 110251050 鄭捷方 106213050 朱昱丞 110211040 陳亨毓 110251039 黃凱葶 110251035 溫嘉泓 110211052 林世鎧 110211034 洪橞䈶 110251043 許家維 110251040 陳柔云 110211013 顏庭茂 110251041 魏敏如 110251037 蔣水晶 110211046 何思雅 110211002 王敏甄 110251018 李佳臻 110211058 鄭宜蓁 110211030 劉昱岑 110211060 吳宜軒 110251030 溫瑩瑄 110211009 李佳蓁 110211037 粘伊萱 110211041 戚佩琳 110251029 廖韋茹 110211062 王郁亨 109211067 古宇立 108251026 許詠翔 110251020 王雅蓁 110251017 韓育欣 110251023 陳懷恩 110211032 郭芝榛 110211051 林秉楓 110251021 潘妘昕 110251019 林益任 110251051 王方琦 110251028 傅翊安 110211014 陳柏勳 110251003 陳千晴 110251004 翟品荃 110251013 江羽晴 110251012 陳玟伃 110251005 陳品蓉 110251026 王愉盛 110211031 江以薰 110211022 吳姿儀 110211007 譚厚誼 110211053 廖振羽 109251040 傅善鉑 110211036 葉平超 110211024 蕭逸韋 110211029 張彥程 110211061 陳柏揚 110211023 薛皓均 110211015 吳玗苀 110251015 吳依蓁 110251032 黃元泓 110251045 劉冠伯 110211011 黃翊喆 110211055 吳耀登 110251006 陳薏如 110251038 周宗永 110211063 陳玉珊 110251011 趙奕媗 110211033 蘇家陞 110251024 邱亮云 110251047 盧承徵 109105031 簡志安 109105030 陳柏揚
{"metaMigratedAt":"2023-06-16T19:34:56.152Z","metaMigratedFrom":"Content","title":"程式設計個人筆記","breaks":true,"contributors":"[{\"id\":\"cf6d255d-5e7b-4199-a272-4b78757db16f\",\"add\":83277,\"del\":29951}]"}
Expand menu