---
# System prepended metadata

title: 程式設計（第24組） 07/03/2022

---

# 程式設計（第24組） 07/03/2022

組長：黃凱葶 110251039 管院學士班學士班1年級
組員：林世鎧 110211052 經濟系學士班1年級
組員：周芃君 110211008 經濟系學士班1年級
組員：蘇家陞 110211033 經濟系學士班1年級

---

###### `基本知識`
* Symbols宣告哪些變數當符號
* ""(引起來叫字串)
* 沒有引起來叫數字
* 智慧編譯的功能 highlight print 就回出現
* 在程式裏面放#不會成爲指令，不會被執行（#代表注解）

---

### Python Variables - Assign Multiple Values
x,y,z=symbols(‘x y z’)外面三個，裏面三個

例子：
1.x,y,z="a","b","c"
  print(x)
  print(y)
  print(z)
  a
  b
  c

---

### Python - Output Variables 
例子：
1.x = "awesome"
  print("Python is " + x)（要傳進  去的參數）
  Python is awesome

* +是透過+把他串接起來

2.x = "Python is "（把字串指定給x）
  y = "awesome"（把字串指定給y）
  z =  x + y（設定給z）
  print(z)
  z =  x + y#（設定給z）


3.x = 5
  y = "John"
  print(x + y)
（錯誤，因爲字串不能跟數字相加）


---

### Python Syntax
if 5 > 2:（：表示到這一行爲止）
  print("Five is greater than two!")（要對齊，要内縮）
Five is greater than two!

if 5 < 2 (如果改成小於，會不成立)
  print("Five is greater than two!")（因爲不對應）
  
 ---
 
* Type指令告訴我們那個變數是什麽形態
* Int是整數的簡稱
* Str是字串
* float是浮點數

例子：
1.x=5
  type(x)
  print(type(x))
  <class’int’>

2.x=5.5
  type(x)
  print(type(x))
  <class’float’>

3.x=5
  y=3
  print(type(x))
  print(type(y))
  x+y
  <class’int’>
  <class’int’>
  8
  
4.x="5"
  y="3"
  print(type(x))
  print(type(y))
  x+y
  <class’int’>
  <class’int’>
  53
  
 ---
 
###  Python Data Types
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

---

### Python Casting
* Casting把某個内容印轉成某個形態

x = str(3)    # x will be '3'
y = int(3)    # y will be 3
z = float(3)  # z will be 3.0
把3設爲整數的型態再傳爲設定給y
把3設爲浮點數（float）的型態再傳爲設定給z


例子：
1.x = int(1)
  y = int(2.8)
  z = int("3")
  print(x)
  print(y)
  print(z)
  1
  2
  3
  
---

### Variable Names

myvar = "John"
my_var = "John"
_my_var = "John"
myVar = "John"
MYVAR = "John"
myvar2 = "John"

---

### Case-Sensitive
* 變數大小寫不一樣

例子：
1.A=1
  a=1
  print(a)
  1
  
---

### Python User Input

a=input("Enter a age:")
b=input("Enter b age:")
print(a+b)
Enter a age:10
Enter b age:10

---
開會記錄：
日期：2022年3月9日
開始時間：晚上9：00
結束時間：晚上9：33
内容：找最大值、最小值、排列和總共多少個元素
![](https://i.imgur.com/KmsBRt1.jpg)

---

#### 作業：
![](https://i.imgur.com/rbmhVBm.png)

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]
lst.sort()
print(lst)
###### 順序排列
[66, 253, 541, 559, 569, 610, 614, 906, 916, 1008, 1210, 1603, 1735, 1788, 1943, 2158, 2244, 2454, 2789, 2805, 2831, 3160, 3452, 3462, 3476, 3501, 3597, 3704, 3873, 3900, 3986, 4076, 4162, 4970, 5045, 5071, 5172, 5176, 5522, 5704, 6168, 6300, 6345, 6355, 6450, 6671, 6673, 6790, 6859, 6914, 6937, 6966, 6975, 6988, 7070, 7075, 7252, 7521, 7557, 7592, 7668, 7696, 7697, 7807, 7931, 7952, 7967, 8094, 8266, 8317, 8367, 8562, 8919, 9008, 9116, 9306, 9448, 9513, 9607, 9629, 9695, 9736, 9922, 9931, 9943, 10056, 10236, 10268, 10315, 10368, 10600, 10733, 10752, 10793, 10799, 11071, 11098, 11779, 11784, 12004, 12039, 12101, 12251, 12306, 12398, 12638, 12685, 13111, 13151, 13290, 13657, 13908, 14120, 14244, 14250, 14301, 14315, 14421, 14528, 14569, 14673, 14916, 14933, 14966, 14969, 14986, 15074, 15101, 15180, 15344, 15524, 15534, 15612, 15678, 15689, 15701, 15815, 16224, 16406, 16796, 16920, 17088, 17120, 17250, 17441, 17540, 17594, 17729, 17805, 17966, 17988, 18091, 18123, 18160, 18192, 18390, 18408, 18500, 18666, 18758, 18886, 19202, 19242, 19271, 19391, 19425, 19428, 19604, 19703, 19728, 19773, 20016, 20061, 20066, 20100, 20295, 20311, 20384, 20441, 20481, 20490, 20754, 20861, 20906, 20978, 21123, 21133, 21190, 21217, 21220, 21291, 21358, 21373, 21421, 21488, 21495, 21557, 21883, 21908, 21994, 22066, 22076, 22222, 22309, 22476, 22594, 22704, 22834, 22907, 23017, 23196, 23222, 23282, 23395, 23406, 23407, 23417, 23667, 23908, 23967, 24107, 24293, 24496, 24527, 24564, 24889, 25047, 25451, 25507, 25528, 25531, 25792, 25900, 26058, 26152, 26224, 26242, 26250, 26326, 26351, 26378, 26415, 26438, 26591, 26727, 26808, 26855, 26905, 26907, 26917, 27022, 27278, 27671, 27905, 28267, 28298, 28739, 28772, 28772, 28883, 28897, 28947, 28989, 29061, 29107, 29183, 29406, 29494, 29499, 29540, 29544, 29641, 29695, 29720, 29856, 29880, 29910, 29960, 30041, 30275, 30438, 30466, 30600, 30638, 30669, 30767, 30972, 30998, 31192, 31270, 31475, 31528, 31665, 31948, 32107, 32113, 32186, 32190, 32353, 32448, 32507, 32526, 32584, 32617, 32662, 32707, 32787, 32934, 33171, 33381, 33389, 33663, 33713, 33740, 33780, 33971, 34062, 34200, 34381, 34398, 34575, 34576, 34603, 34762, 35094, 35103, 35126, 35170, 35196, 35254, 35302, 35312, 35469, 35519, 35580, 35602, 35771, 35790, 35827, 35883, 35911, 36043, 36053, 36193, 36230, 36275, 36590, 36618, 36787, 36845, 36887, 36919, 36994, 37312, 37377, 37415, 37463, 37691, 37705, 37708, 37724, 37724, 37824, 37842, 37926, 38086, 38210, 38609, 38748, 38871, 38927, 39000, 39017, 39027, 39203, 39237, 39264, 39342, 39500, 39555, 39581, 39700, 39921, 40010, 40095, 40419, 40450, 40702, 40871, 40910, 41006, 41060, 41248, 41369, 41379, 41579, 41616, 41691, 41899, 41957, 41967, 42489, 42783, 42809, 42911, 43109, 43245, 43249, 43251, 43290, 43448, 43610, 43770, 43824, 43837, 44064, 44229, 44303, 44336, 44338, 44451, 44510, 44715, 44863, 44884, 45024, 45124, 45181, 45223, 45263, 45284, 45348, 45445, 45848, 45872, 45878, 45940, 46083, 46170, 46378, 46412, 46418, 46451, 46501, 46507, 46527, 46574, 46602, 46627, 46728, 46928, 47008, 47323, 47394, 47456, 47497, 47520, 47752, 47884, 48006, 48032, 48072, 48111, 48235, 48292, 48481, 48567, 48936, 49046, 49665, 49674, 49692, 49821, 50152, 50447, 50596, 50610, 50702, 50728, 50781, 50848, 50908, 50948, 51428, 51609, 51613, 51744, 51834, 51888, 52042, 52161, 52189, 52262, 52355, 52406, 52454, 52485, 52574, 52637, 52659, 52707, 52719, 52730, 52951, 52995, 53024, 53071, 53134, 53301, 53380, 53402, 53492, 53503, 53829, 53901, 53960, 54075, 54084, 54220, 54602, 54777, 55032, 55044, 55240, 55317, 55344, 55399, 55478, 55510, 55588, 55597, 55664, 55701, 55742, 55978, 56036, 56074, 56135, 56186, 56239, 56278, 56421, 56491, 56749, 56776, 56848, 56887, 56889, 56995, 57058, 57130, 57208, 57248, 57263, 57348, 57434, 57539, 57664, 57874, 57923, 57954, 58283, 58366, 58379, 58436, 58507, 58510, 58554, 58556, 58715, 58956, 59051, 59119, 59210, 59260, 59263, 59273, 59333, 59352, 59478, 59648, 59823, 59847, 59912, 59936, 60028, 60029, 60094, 60227, 60235, 60329, 60358, 60379, 60474, 60572, 60652, 60685, 60814, 60920, 61013, 61028, 61107, 61289, 61437, 61606, 61864, 61873, 62054, 62196, 62267, 62350, 62532, 62810, 62952, 63247, 63262, 63444, 63469, 63554, 63582, 63661, 63954, 63985, 64092, 64093, 64269, 64293, 64637, 64900, 65085, 65406, 65491, 65513, 65681, 65682, 65693, 65746, 66005, 66022, 66204, 66243, 66324, 66675, 66691, 66714, 66767, 66872, 66903, 67045, 67194, 67257, 67360, 67395, 67422, 67439, 67500, 67533, 67578, 67653, 67678, 67776, 67783, 67852, 68000, 68539, 68628, 68637, 68705, 68829, 68888, 69076, 69115, 69491, 69537, 69751, 69792, 69823, 70025, 70096, 70237, 70461, 70665, 70751, 71143, 71282, 71467, 71480, 71555, 71592, 71705, 71767, 71810, 71954, 71968, 71976, 72418, 72472, 72518, 72601, 72639, 72679, 72740, 72765, 72782, 72995, 73188, 73188, 73219, 73225, 73274, 73437, 73467, 73529, 73597, 73624, 73696, 73851, 73953, 73967, 73980, 74193, 74337, 74425, 74435, 74457, 74493, 74844, 74883, 74936, 75038, 75079, 75160, 75194, 75461, 75549, 75581, 75601, 75615, 75689, 75872, 75978, 76030, 76211, 76258, 76454, 76629, 76781, 77037, 77089, 77188, 77341, 77369, 77379, 77493, 77506, 77822, 77950, 78013, 78102, 78147, 78193, 78216, 78543, 78562, 78616, 78634, 78671, 78700, 78740, 78780, 78817, 78983, 78994, 79167, 79197, 79208, 79307, 79441, 79642, 79655, 79730, 79926, 79996, 80011, 80030, 80048, 80126, 80212, 80228, 80427, 80434, 80519, 80559, 80689, 80743, 80980, 81307, 81328, 81393, 81438, 81441, 81530, 81673, 82070, 82434, 82525, 82544, 82581, 82585, 82633, 82709, 82776, 82822, 82936, 83015, 83106, 83216, 83236, 83285, 83301, 83730, 83821, 83896, 83896, 83905, 83924, 84019, 84083, 84090, 84115, 84141, 84297, 84301, 84376, 84614, 84670, 84749, 84908, 84911, 85171, 85298, 85757, 85910, 85955, 86015, 86133, 86199, 86309, 86325, 86367, 86374, 86702, 86743, 86760, 86876, 86945, 87021, 87151, 87165, 87296, 87379, 87405, 87767, 88073, 88101, 88352, 88416, 88492, 88503, 88538, 88610, 88835, 88852, 88928, 88965, 88968, 88993, 89005, 89124, 89127, 89265, 89269, 89278, 89285, 89392, 89828, 89844, 89907, 89952, 89998, 90065, 90224, 90315, 90442, 90649, 90709, 90735, 90747, 90880, 90976, 91011, 91049, 91053, 91095, 91290, 91330, 91375, 91619, 91760, 91853, 91910, 92032, 92113, 92274, 92588, 92589, 92592, 92659, 92715, 92761, 92828, 92856, 92919, 92929, 93019, 93115, 93141, 93154, 93170, 93184, 93250, 93393, 93425, 93525, 93604, 93701, 93711, 94085, 94120, 94132, 94257, 94267, 94332, 94385, 94458, 94510, 94523, 94574, 94631, 94646, 94654, 94672, 94743, 95607, 95925, 95929, 95999, 96052, 96128, 96349, 96662, 96696, 96729, 96843, 96843, 96880, 96892, 96949, 97008, 97079, 97136, 97148, 97169, 97229, 97470, 97563, 97697, 97889, 97898, 97913, 98235, 98326, 98495, 98568, 98577, 98581, 98735, 99059, 99140, 99492, 99493, 99517, 99654, 99690, 99739, 99792, 99832, 99867, 99872, 99952]

###### 找最大值
![](https://i.imgur.com/ZUrrZAR.png)



###### 找最小值
解1.![](https://i.imgur.com/O8Evjk8.png)
解2.![](https://i.imgur.com/GEa3hrA.png)

###### 找多少個元素
![](https://i.imgur.com/w67szZp.png)

