Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Python 程式設計入門 (二)
Search
EAGOAR 國際教育
November 11, 2016
Education
150
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Python 程式設計入門 (二)
認識算術、關係、邏輯運算式及 input()、if/elif/else 指令。
EAGOAR 國際教育
November 11, 2016
More Decks by EAGOAR 國際教育
See All by EAGOAR 國際教育
EAGOAR 國際教育簡介
eagoar
0
140
Python 程式設計入門 (三)
eagoar
0
190
Python 程式設計入門 (一)
eagoar
0
340
Other Decks in Education
See All in Education
新型コロナ禍をともに「楽しみながら開いていこう!」 :中門 吉松 会員(2720 Japan O.K.ロータリーEクラブ)卓話 : 2026.10.19.例会・卓話
2720japanoke
0
220
LEGO Geometry Tutorial
arnoknobbe
0
720
Web Application Frameworks - Lecture 3 - Web Technologies (1019888BNR)
signer
PRO
0
3.6k
CSS3 and Responsive Web Design - Lecture 5 - Web Technologies (1019888BNR)
signer
PRO
1
3.5k
AWS Academy プログラムのご紹介
hiragahh
0
110
Modulo : abc
robintux
0
240
私たちはなんでテストするんだっけ? Ver.東北IT物産展2026 in 会津若松
camel_404
3
220
学習者データを「見る」:外国語教師のためのデータの入力、分析、解釈方法
uranoken
0
440
AIの力を100%引き出すために
frievea
0
610
Sanapilvet opetuksessa
matleenalaakso
1
36k
An Experiment in "Cross-Cultural Exchange" as a Method for Content Creation
naoji_taniguchi_ksk_0827
0
250
Science Tokyo University for International Research Excellence scheme_April 2026
sciencetokyo
PRO
0
520
Featured
See All Featured
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.4k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
710
Product Roadmaps are Hard
iamctodd
55
13k
Context Engineering - Making Every Token Count
addyosmani
9
1.2k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
46k
Six Lessons from altMBA
skipperchong
29
4.5k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Evolving SEO for Evolving Search Engines
ryanjones
0
330
Are puppies a ranking factor?
jonoalderson
2
4.1k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.6k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
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 用法。 本堂作業