Python a p p l e b e a r c Fruit Animal a p p l e b e a r c 2-2

Similar documents
Spyder Anaconda Spyder Python Spyder Python Spyder Spyder Spyder 開始 \ 所有程式 \ Anaconda3 (64-bit) \ Spyder Spyder IPython Python IPython Sp

C/C++ - 函数

数据结构与算法 - Python基础

untitled

CC213

電腦做什麼事~第七章

第5章修改稿


untitled

新・解きながら学ぶJava

四川省普通高等学校

學 習 目 標 1. 了 解 有 計 畫 的 運 動 之 前, 實 施 身 體 檢 查 的 重 要 性 2. 了 解 熱 身 與 緩 和 運 動 可 以 預 防 運 動 傷 害 3. 了 解 包 紮 護 具 裝 備 與 場 地 器 材 的 維 護, 可 以 避 免 傷 害 發 生 4. 了 解 食


ttian

<D7DCCEC4BCFE2E696E6464>


第3章.doc

( CIP) /. :, ( ) ISBN TP CIP ( 2005) : : : : * : : 174 ( A ) : : ( 023) : ( 023)

Microsoft Word - 2AF63內文.doc

老煙槍

第一章

新・明解Python入門

1abcd.doc

Achieving One TeraFLOPS with 28-nm FPGAs

Microsoft Word - 第3章.doc

C/C++ - 文件IO

CC213

untitled

Microsoft Word - 第三章第一節第二節.doc

電機工程系認可證照清單 /7/1

Java

電腦做什麼事~第六章

公共圖書館利用教育方案規劃之研究


<4D F736F F D B0EABB79A4E5B8D5C344BBBCB065AAA9>


康體藝術

Microsoft PowerPoint - OPVB1基本VB.ppt

chp6.ppt

C/C++语言 - 分支结构

Go构建日请求千亿微服务最佳实践的副本

nooog

<4D F736F F D DA5BFA6A1C476C1C92DBEC7ACECB8D5A8F728B57BB35D292E646F63>

Microsoft Word 选题

她 氣 色 很 差 我 跟 她 打 了 兩 次 招 呼 她 才 回 我 這 樣 妳 去 打 個 電 話 給 她 看 看 她 現 在 人 在 哪 裡 好 資 料 應 該 在 這 裡 這 地 方 是 前 幾 天 不 是 怎 麼 了 在 找 什 麼 尹 小 姐 下 午 就 出 去 到 現 在 還 沒 回

C/C++ - 字符输入输出和字符确认

C/C++ 语言 - 循环

untitled

CHAPTER VC#

untitled

untitled

Java java.lang.math Java Java.util.Random : ArithmeticException int zero = 0; try { int i= 72 / zero ; }catch (ArithmeticException e ) { // } 0,

(京)新登字063号

Ps22Pdf

3.1 num = 3 ch = 'C' 2

(Microsoft Word - Motion Program \270\305\264\272\276\363 \307\245\301\366 \271\327 \270\361\302\367.doc)

C/C++语言 - 运算符、表达式和语句

Microsoft Word - 01.DOC

C/C++程序设计 - 字符串与格式化输入/输出

untitled

CC213

考 纲 解 读 14 浙 江 省 普 通 高 考 语 文 科 考 纲 研 读 吴 美 琴 今 年 的 考 试 说 明, 我 用 了 八 个 字 进 行 概 括, 那 就 是 稳 中 微 调, 关 注 生 活 稳 中 微 调 :14 年 的 语 文 考 试 说 明 是 近 几 年 来 调 整 幅 度

uestion ox 初五等合1題庫 Multiple Choice uestion 98年特種考試地方政府公務人員考試試題 1 公務人員請假規則是依據何法律授權所定之 ()公務人員任用法 ()公務員服務法 (C)公務人員俸給法 (D)公務人員保障法 解析 公務員服務法第12條 公務員除因婚喪 疾病

Microsoft Word - PHP7Ch01.docx

使 用 Java 语 言 模 拟 保 险 箱 容 量 门 板 厚 度 箱 体 厚 度 属 性 锁 具 类 型 开 保 险 箱 关 保 险 箱 动 作 存 取 款

WWW PHP

Guide to Install SATA Hard Disks

填 写 要 求 1. 以 word 文 档 格 式 如 实 填 写 各 项 2. 表 格 文 本 中 外 文 名 词 第 一 次 出 现 时, 要 写 清 全 称 和 缩 写, 再 次 出 现 时 可 以 使 用 缩 写 3. 本 表 栏 目 未 涵 盖 的 内 容, 需 要 说 明 的, 请 在

Chapter 1 選 用 好 的 燜 燒 罐 選 用 好 的 燜 燒 罐 是 做 好 燜 燒 罐 料 理 最 重 要 的 步 驟, 除 了 須 注 意 使 用 的 材 質 是 否 符 合 食 器 使 用 標 準, 也 須 注 意 燜 燒 罐 的 保 溫 效 果, 才 能 安 心 享 用 燜 燒 罐

Microsoft Word - ACG chapter00c-3ed.docx

PowerPoint プレゼンテーション

5-2微积分基本定理

Microsoft Word - 财务d08z.doc

Microsoft Word - C-pgm-ws2010.doc

ebook39-6

untitled


全国计算机技术与软件专业技术资格(水平)考试

Microsoft Word - XRD Operation Manual.doc

09 (File Processes) (mkdir) 9-3 (createnewfile) 9-4 (write) 9-5 (read) 9-6 (deletefile) 9-7 (deletedir) (Exercises)

jsj0.nps

Microsoft Word - 09.數學 docx


lnag_ch_v2.01.doc

個 人 的 手, 拉 著 瞎 子 的 手 把 他 帶 往 村 外 的 時 候, 對 於 瞎 子 來 講, 那 個 人 的 手 和 耶 穌 的 手 有 沒 有 區 別? 沒 有! 為 什 麼 沒 有 區 別? 因 為 對 於 一 個 瞎 子 來 說, 手 和 耳 朵 就 是 他 接 觸 世 界, 瞭

数据挖掘之分类

epub 33-8

untitled

<5B BECBB0EDB8AEC1F25D312D34B0AD5FC3E2BCAEBCF6BEF7C0DAB7E F31702E504446>

lim f(x) lim g(x) 0, lim f(x) g(x),

彩圖 6 彩圖 7 彩圖 8 3

Microsoft PowerPoint - Lecture7II.ppt

33 UThKAlPu ,000 1, , Nevado del Ruiz


Java 程式設計初階 第 5 章:基本輸出入 & 流程控制

C

C C

3-1 Wii ( )

untitled

FY.DOC

Transcription:

Chapter 02 變數與運算式 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.2 2.2.1 2.2.2 2.2.3 type 2.2.4 2.3 2.3.1 print 2.3.2 input 2.4 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 + 2.4.6 Python

Python 2.1 2.1.1 a p p l e b e a r c 65438790 Fruit Animal a p p l e b e a r c 2-2

02 2.1.2 Python = score 80 score = 80 Python score (int) fruit = " " #fruit a b c 20 a = b = c = 20,, age 18 name age, name = 18, " " del score del score 2-3

Python 2.1.3 Python Python Python acos and array asin assert atan break class close continue cos Data def del e elif else except exec exp fabs float finally floor for from global if import in input int is lambda log log10 not open or pass pi print raise range return sin sqrt tan try type while write zeros Python 3.x 7eleven George&Mary George Mary if & Python 2-4

02 2.4.2 == 1 2!= 1 2 > 1 2 < 1 2 >= 1 2 <= 1 2 (6+9==2+13) (8+9==2+13) (8+9!=2+13) (6+9!=2+13) (8+9>2+13) (6+9>2+13) (5+9<2+13) (8+9<2+13) (6+9>=2+13) (3+9>=2+13) (3+9<=2+13) (8+9<=2+13) = == = a=5 a 5 == a==5 a 5 2.4.3 not and not(3>5) not(5>3) (5>3) and (9>6) (5>3) and (9<6) (5<3) and (9>6) (5<3) and (9<6) 2-17

Python or (5>3) or (9>6) (5>3) or (9<6) (5<3) or (9>6) (5<3) or (9<6) and and or or 2.4.4 i 3 i = i + 3 = 2-18

02 i += 3 # i = i + 3 i -= 3 # i = i 3 i 10 += i += 5 15 -= i -= 5 5 *= i *= 5 50 /= i /= 5 2 %= i %= 5 0 //= i //= 5 2 **= i **= 3 1000 *(1+ ) 2% 6 (<complex.py>) ch02\complex.py 1 deposit = int(input(" ")) 2 times = 1.02 ** 6 3 deposit *= times 4 print("6 " + str(deposit)) 2-19

Chapter 03 判斷式 3.1 Python 3.1.1 Python 3.1.2 Tab 3.2 3.2.1 3.2.2 if 3.2.3 if else 3.2.4 if elif else 3.2.5 Python

Python 3.1 Python C Java {} if(score>=60) { grade = " "; } sum = sum + score 3.1.1 Python Python : 1 Tab 4 if(score>=60): grade = " " sum = sum + score Tab 4 Python Tab 4 Tab 3.1.2 Tab Tab Tab 4 Tab Python -t Tab -tt 3-2

03 3.2 3.2.1 Python 判斷式 if elif else 迴圈 4 for while 3.2.2 if if if if ( ): ( ) if : 3-3

Python x>2 x>2 or x<5 if ( ): 1234 (<password1.py>) ch03\password1.py 1 pw = input(" ") 2 if(pw=="1234"): 3 print(" ") 3-4

程式說明 2-3 3 03 1234 3 if Tab 4 if 2-3 if(pw=="1234"): print(" ") 3.2.3 if else if if else if else if ( ): else: if else if else 3-5

Python 1234 (<password2.py>) ch03\password2.py 1 pw = input(" ") 2 if(pw=="1234"): 3 print(" ") 4 else: 5 print(" ") 程式說明 2-3 3 4-5 5 4 else: 60!! (<score.py>) 3-6

Chapter 07 函式與套件 7.1 7.1.1 7.1.2 7.1.3 7.2 7.2.1 7.2.2 7.2.3 7.3 7.3.1 7.3.2 7.3.3 7.3.4 7.3.5 7.4 7.4.1 import 7.4.2 7.4.3 7.4.4 7.5 7.5.1 7.5.2 7.5.3 Python

07 7.4.3 randint randint.randint(, ) ( ) ( ) import random as r for i in range(0,5): # 5 5 print(r.randint(1,10), end=",") #9,8,1,10,4, 1 10 randrange randrange randint.randrange(, [, ]) ( ) ( ) 1 import random as r for i in range(0,5): # 5 5 print(r.randrange(0,12,2), end=",") #8,0,10,6,6, 0 2 12 ( ) 0 2 4 6 8 10 7-25

Python random random 0 1.random() import random as r print(r.random()) #0.5236730771512399 uniform uniform.uniform(, ) import random as r print(r.uniform(3,10)) #6.063374013178429 [ENTER] 1 6 [ENTER] (<randint.py>) [ENTER] 7-26

Python 7.4.4 choice choice.choice( ) import random as r for i in range(0,5): # 5 5 print(r.choice("abcdefg"), end=",") #f,a,g,g,d, import random as r for i in range(0,5): # 5 5 print(r.choice([1,2,3,4,5,6,7]), end=",") #1,1,2,7,6, sample sample choice sample.sample(, ) import random as r print(r.sample("abcdefg",3)) #['f', 'b', 'g'] print(r.sample([1,2,3,4,5,6,7],3)) #[3, 1, 4] 7-28

07 import random as r print(r.sa mple([1,2,3,4,5,6,7],8)) # sample 6 1 49 1 (<sample.py>) ch07\sample.py 1 import random as r 2 3 list1 = r.sample(range(1,50), 7) 4 special = list1.pop() 5 list1.sort() 6 print(" ", end="") 7 for i in range(0,6): 8 if i == 5: print(str(list1[i])) 9 else: print(str(list1[i]), end=", ") 10 print(" " + str(special)) 7-29

Appendix A MTA Python 程式設計核心能力國際認證模擬試題 A n d i ninin n Python

Python ( MTA Python ) 4. 5 = 5 = 60 5 17 = 120 17 = 180 def ticket _ fee(age, school): fee = 0 (1) fee = 60 (2) (3) fee = 120 else: fee = 180 return fee ( )(1) A. if age >= 5 and school == : B. if age >= 5 and school == : C. if age <= 17 ( )(2) A. if age >= 5 and school == : B. if age >= 5 and school == : C. if age <= 17 ( )(3) A. if age >= 5 and school == : B. if age >= 5 and school == : C. if age <= 17 5. Python 1 2 2 nu m = int(input(" : ")) digits = "0" if num > 0: (1) digits = "1" A-14