Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
a logic gate in Python program
BASIC PYTHON
DIVIDERSLIDESection title
BASIC PYTHONa logic gate in Python program
Olarik Surinta, PhDLecturer
3
Logic gates
Cr. https://forums.autodesk.com/t5/autocad-electrical-forum/autocad-electrical-logic-circuit-help/td-p/6706653
4
if statement
5
if..else statement
6
Practice
1) เขขยนโปรแกรมเพพพอคคคนวณเกรด ในกรณขทขพ– นนสนตไดดคะแนนตต ดงแตพ 0 – 60 จะไดดเกรด U– นนสนตไดดคะแนนตต ดงแตพ 61 – 100 จะไดดเกรด S
7
if..elif..else statement
Cr. https://docops.ca.com/ca-easytrieve/11-6/en/language-reference/statements-g-m/if-else-if-else-and-end-if-statements
8
if..elif..else statement
9
Practice
1) เขขยนโปรแกรมเพพพอคคคนวณเกรด ในกรณขทขพ– นนสนตไดดคะแนนตต ดงแตพ 0 – 49 จะไดดเกรด F– นนสนตไดดคะแนนตต ดงแตพ 50 – 55 จะไดดเกรด D+– นนสนตไดดคะแนนตต ดงแตพ 56 – 59 จะไดดเกรด D– นนสนตไดดคะแนนตต ดงแตพ 60 – 64 จะไดดเกรด C+– นนสนตไดดคะแนนตต ดงแตพ 65 – 69 จะไดดเกรด C– นนสนตไดดคะแนนตต ดงแตพ 70 – 74 จะไดดเกรด B– นนสนตไดดคะแนนตต ดงแตพ 75 – 79 จะไดดเกรด B+– นนสนตไดดคะแนนตต ดงแตพ 80 – 100 จะไดดเกรด A
10
AND gate
● if … else statement
Cr. http://phpelearnsite.blogspot.com/2012/07/php-ifelse-statements-conditional.html
11
OR gate
12
NOT gate
13
NAND gate
Cr. http://www.hardwaresecrets.com/introduction-to-logic-gates/4/ http://verticalhorizons.in/universal-gates-in-digital-electonics-nand-and-nor/
14
NAND gate
AND gate
NOT gate
15
NOR gate
Cr. http://www.hardwaresecrets.com/introduction-to-logic-gates/4/http://hyperphysics.phy-astr.gsu.edu/hbase/Electronic/nor.html
Practice
16
NOR gate
17
XOR gate
Cr. http://hyperphysics.phy-astr.gsu.edu/hbase/Electronic/xor.html
18
XOR gate Practice
19
XOR gate
20
XOR gate Practice
21
XOR gate