Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Python 程式設計入門 (二)
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
EAGOAR 國際教育
November 11, 2016
Education
0
120
Python 程式設計入門 (二)
認識算術、關係、邏輯運算式及 input()、if/elif/else 指令。
EAGOAR 國際教育
November 11, 2016
Tweet
Share
More Decks by EAGOAR 國際教育
See All by EAGOAR 國際教育
EAGOAR 國際教育簡介
eagoar
0
120
Python 程式設計入門 (三)
eagoar
0
170
Python 程式設計入門 (一)
eagoar
0
330
Other Decks in Education
See All in Education
コマンドラインを見直そう(1995年からタイムリープ)
sapi_kawahara
0
660
Introduction - Lecture 1 - Next Generation User Interfaces (4018166FNR)
signer
PRO
2
4.4k
Evaluation Methods - Lecture 6 - Human-Computer Interaction (1023841ANR)
signer
PRO
0
1.3k
1202
cbtlibrary
0
210
悩める リーダー達に 届けたい書籍|レジリエントマネジメント 書籍イントロダクション-260126
mimoza60
0
280
MySmartSTEAM 2526
cbtlibrary
0
190
XML and Related Technologies - Lecture 7 - Web Technologies (1019888BNR)
signer
PRO
0
3.2k
CSS3 and Responsive Web Design - Lecture 5 - Web Technologies (1019888BNR)
signer
PRO
1
3.1k
2025-12-11 nakanoshima.dev LT
takesection
0
110
くまのココロンともぐらのロジ
frievea
0
150
160人の中高生にAI・技術体験の講師をしてみた話
shuntatoda
1
300
栃木県警サイバーセキュリティ研修会2026
nomizone
0
190
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.1k
Everyday Curiosity
cassininazir
0
130
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.1k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
780
Ruling the World: When Life Gets Gamed
codingconduct
0
140
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
The untapped power of vector embeddings
frankvandijk
1
1.6k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
130
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
140
Ethics towards AI in product and experience design
skipperchong
2
190
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
140
Transcript
程式設計入門 (二)
Python 算術運算式
上堂課我們練習了加、減、乘、除運算,其中 +, - , * , / 我們稱之為運算符號。 這一堂,我們來介紹其他幾個運算符號: 1.
整除:// (範例畫面為 Mac電腦 Python Shell 畫面) 這個範例,可以很明顯看出 / 和 // 的不同。
2. 次方:** 3. 取餘數:%
4. 指定值到變數:= 程式設計有一個很重要的觀念叫「變數」,變數就像 一個容器,可以存放不同的值。看下面範例可以更容易 理解: a 和 b 就是所謂的變數。我們把計算後的值放入這兩個 變數中,分別輸入這兩個變數a和b後按「ENTER」,就
會顯示這兩個變數的數值。
Python 關係運算式
什麼是關係運算式?簡單說,就是比大小。這在往後程 式控制流程中將會是很重要的判斷。 運算符號 功用 運算符號 功用 < 小於 <= 小於或等於
== 等於 != 不等於 > 大於 >= 大於或等於 透過關係運算式判斷對 (True) 或錯 (False)。
Python 邏輯運算式
邏輯運算式就是「而且」、「或」、「非」: 運算符號 功用 運算符號 功用 and 而且 or 或 not
否、非 邏輯運算式的使用我們稍後再做說明。
Python IDLE 介面
為了開發越來越複雜的 程式,我們來介紹 Python 的 IDLE 開發介 面,讓我們可以把程式 碼存成一個檔案之後再 來執行。
請執行 Python 安裝完 後的 IDLE 程式。
IDLE 開啟後,執行 File/New File 開啟一個新檔案。
我們寫了一個新程式如下:
input( ) 指令會讀取鍵盤輸入的資料,一般會把資 料存在一個變數中。 指令:input( ) 判斷式,如果符合,就會執行該判斷式後面的動作。 特別提醒:If…elif...else 後面必須加:。
指令:if … elif ... else
這個程式就是讓使用者透過 input() 指令回答兩個問題, 然後依據回答,顯示不同的判斷結果。 在這個例子中,就可以看到邏輯運算式的應用。
之後另存新檔,附檔名只能是 py 或是 pyw。
Run/Run Module 執行程式。
程式執行結果:
1. 熟悉算數、關係、邏輯運算式。 2. 熟悉 input()、if/elif/else 用法。 本堂作業