Skip to content

Commit cea69f0

Browse files
author
kongruksiamza
authored
Add files via upload
0 parents  commit cea69f0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+555
-0
lines changed

Diff for: Function

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
ฟังก์ชั่นคืออะไร / ตัวอย่างฟังก์ชั่น
2+
การสร้างฟังก์ชั่น
3+
การเรียกฟังก์ชั่น
4+
Global Variable / Local Variable
5+
Arguments / Parameter
6+
2 Arguments
7+
Arbitrary Arguments *args
8+
Keywords Parameter
9+
Default Parameter
10+
Arbitrary Arguments **kwargs

Diff for: Image/Assignment Operator.jpg

85.8 KB

Diff for: Image/Comparison Operator.png

2.92 KB

Diff for: Image/Data Type.png

380 KB

Diff for: Image/DataStructureFlow-591x365.png

32.5 KB

Diff for: Image/Hanoi Goal.png

36.7 KB

Diff for: Image/IMG_0658-e1556096871649.png

205 KB

Diff for: Image/List/DataStructureFlow-591x365.psd

434 KB

Diff for: Image/List/Hanoi/1_eR2gxp8mKeaEWbbj4-cLMQ.png

77.3 KB

Diff for: Image/List/Hanoi/Hanoi.gif

17.7 KB

Diff for: Image/List/Hanoi/Tower_of_Hanoi.jpeg

123 KB

Diff for: Image/List/Hanoi/Tower_of_Hanoi_4.gif

193 KB

Diff for: Image/List/Hanoi/daa-tower-of-hanoi.png

11.3 KB

Diff for: Image/List/Hanoi/hanoi04d.gif

6.82 KB

Diff for: Image/List/Hanoi/unnamed.gif

104 KB

Diff for: Image/List/List Definition.PNG

14.5 KB

Diff for: Image/List/Non-Primitive.png

24.6 KB

Diff for: Image/List/Non.png

34.6 KB

Diff for: Image/List/Push.gif

24.3 KB

Diff for: Image/List/loop-over-python-list-animation.gif

591 KB

Diff for: Image/Operator.jpg

55.9 KB

Diff for: Image/board.png

245 KB

Diff for: Image/fahrenheit_to_celsius_formulas.png

14.3 KB

Diff for: Image/keywords-python.png

9.64 KB

Diff for: Image/python-operator-precedence.jpg

190 KB

Diff for: Image/slide_1.jpg

34.5 KB

Diff for: Image/truth-table.png

38.9 KB

Diff for: Image/uH6cL.png

35.3 KB

Diff for: Non Primitive

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
การนิยาม , constructor
2+
การเข้าถึงข้อมูล
3+
การแก้ไขข้อมูล
4+
แสดงผลด้วย Loop
5+
ตรวจสอบข้อมูล
6+
นับจำนวนสมาชิก (len)
7+
len() ทำงานร่วมกับ Loop For
8+
การสร้างและเพิ่มข้อมูล
9+
ทำงานร่วมกับ List
10+
การลบข้อมูล del , การลบแบบ list
11+
ค้นหาและนับจำนวนสมาชิก (Count)
12+
ค้นหาสมาชิกด้วย Index
13+
การ Sort ข้อมูล

Diff for: Phase1/EP1.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
print("Hellos")

Diff for: Phase1/EP10.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#ตัวดำเนินการทางตรรกศาสตร์
2+
3+
#AND = และ
4+
#OR = หรือ
5+
#NOT = ไม่
6+
7+
#คำตอบที่ได้ => จริง / เท็จ
8+
9+
x = (10>5) #ค่า x = bool
10+
y = (10==5) #ค่า y = bool
11+
12+
# z = (5>10) and (10==5)
13+
# 5>10 and 10 == 5
14+
z = (10>5) or (10==5)
15+
16+
print(not z)

Diff for: Phase1/EP11.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#Compound Assignment
2+
3+
x=10
4+
print("ก่อน",x)
5+
# x+=5 # x=x+5
6+
# x-=15 # x = x-15
7+
# x*=5 # x=x*5
8+
# x/=5 # x=x/5
9+
# x//=5
10+
# x**=2 # x= x**2
11+
x%=3
12+
print("หลัง",x)

Diff for: Phase1/EP12.py

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#ลำดับความสำคัญของตัวดำเนินการทางคณิตศาสตร์
2+
3+
x=5+2/10*2-5 # 5+0.4-5
4+
print(x)

Diff for: Phase1/EP13.Assignment1.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#โปรแกรมคำนวณค่า BMI (ดัชนีมวลกาย)
2+
# BMI = น้ำหนัก (kg) / ส่วนสูง * ส่วนสูง (m)
3+
# input / convert to integer
4+
weight=int(input("ป้อนน้ำหนักของคุณ (kg):"))
5+
high=int(input("ป้อนส่วนสูงของคุณ (cm) :"))/100
6+
print("BMI = ",weight/(high**2))

Diff for: Phase1/EP14.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
age=int(input("ป้อนอายุของคุณ :"))
2+
#35
3+
if age>=15 and age <=20:
4+
print("วัยรุ่น")
5+
elif age>=20 and age<=29:
6+
print("วัยหนุ่มสาว")
7+
elif age>=30 and age<=39:
8+
print("วัยผู้ใหญ่")
9+
elif age>=80:
10+
print("วัยชรา")
11+
else :
12+
print("วัยเด็ก")
13+
14+
print("จบโปรแกรม")
15+
16+
# 15 - 20 => วัยรุ่น
17+
# 21 - 29 => วัยหนุ่มสาว
18+
# 30 - 39 => วัยผู้ใหญ่
19+
20+
21+
# and or not

Diff for: Phase1/EP15 Ternary Operator.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
age=int(input("ป้อนอายุของคุณ :"))
2+
#Ternary Operator
3+
print("วัยรุ่น") if age>=15 else print("วัยเด็ก")
4+
5+
print("จบโปรแกรม")
6+
7+
# 15 - 20 => วัยรุ่น
8+
9+
10+
# and or not

Diff for: Phase1/EP16.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# if ซ้อน if
2+
age=int(input("ป้อนอายุของคุณ : "))
3+
4+
if age<=15:
5+
if age==15:
6+
print("ม.3")
7+
elif age==14:
8+
print("ม.2")
9+
elif age==13:
10+
print("ม.1")
11+
else :
12+
print("ประถมศึกษา")
13+
else :
14+
print("ม.ปลาย")
15+
16+
print("จบโปรแกรม")

Diff for: Phase1/EP17.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# pass
2+
age=int(input("ป้อนอายุของคุณ : "))
3+
4+
if age<=15:
5+
if age==15:
6+
pass
7+
elif age==14:
8+
pass
9+
else :
10+
print("ประถมศึกษา")
11+
else :
12+
print("ม.ปลาย")
13+
14+
print("จบโปรแกรม")

Diff for: Phase1/EP18.Assignment2.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# เขียนโปรแกรมหาตัวเลข มาก / น้อย
2+
3+
a=int(input("ป้อนตัวเลขที่ 1 :"))
4+
b=int(input("ป้อนตัวเลขที่ 2 :"))
5+
6+
if a>b :
7+
print(a," มากกว่า ",b)
8+
else :
9+
print(a," น้อยกว่า ",b)

Diff for: Phase1/EP19.Assignment3.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#หาเลขคู่ / คี่
2+
3+
number = int(input("ป้อนตัวเลขของคุณ :"))
4+
5+
# ถ้าหาร 2 ลงตัว => คู่
6+
if number % 2 == 0:
7+
print("เป็นเลขคู่")
8+
else :
9+
print("เป็นเลขคี่")

Diff for: Phase1/EP2.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"""
2+
คำสั่งนี้ใช้ในการแสดงผลข้อความ
3+
และรองแสดงได้ทุกชนิด
4+
นะครับทุกคน
5+
"""
6+
print("Hello World 555")

Diff for: Phase1/EP20.Assignment4.py

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#แลกเงินและหาจำนวนแบงค์
2+
3+
# 2000 => 1000 => 2 ใบ
4+
# 1500 => 1 ใบ , 500 = 1 ใบ
5+
# 1800 => 1 ใบ , 500 = 1 ใบ , 100 => 3 ใบ
6+
# 100 => 50 => 2 ใบ
7+
8+
number = int(input("ป้อนจำนวนเงินของคุณ : "))
9+
10+
# 1500
11+
if number>=1000:
12+
print("1000 บาท = ",number//1000,"ใบ") # 1 ใบ
13+
number%=1000 # 1500 % 1000 = 500
14+
15+
if number>=500:
16+
print("500 บาท = ",number//500,"ใบ")
17+
number%=500
18+
19+
if number>=100:
20+
print("100 บาท = ",number//100,"ใบ")
21+
number%=100
22+
23+
if number>=50:
24+
print("50 บาท = ",number//50,"ใบ")
25+
number%=50
26+
27+
if number>=20:
28+
print("20 บาท = ",number//20,"ใบ")
29+
number%=20

Diff for: Phase1/EP21.Assignment5.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# แปลง ค.ศ เป็น พ.ศ
2+
# แปลง พ.ศ เป็น ค.ศ
3+
4+
number = int(input("ป้อน พ.ศ :"))
5+
6+
# แปลง ค.ศ เป็น พ.ศ + 543
7+
# แปลง พ.ศ เป็น ค.ศ - 543
8+
number=number-543
9+
10+
print("เป็น ค.ศ = ",number)

Diff for: Phase1/EP22.Assignment6.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
weight=int(input("ป้อนน้ำหนักของคุณ (kg):"))
2+
high=int(input("ป้อนส่วนสูงของคุณ (cm) :"))/100
3+
bmi = weight/(high**2)
4+
5+
if bmi>=0 and bmi<18.0:
6+
result="ผอม"
7+
elif bmi>=18.5 and bmi<=22.9:
8+
result="สมส่วน"
9+
elif bmi>=23.0 and bmi<=24.9:
10+
result="น้ำหนักเกิน"
11+
elif bmi>=25.0 and bmi<=29.9:
12+
result="โรคอ้วน ระดับที่ 1"
13+
elif bmi>30:
14+
result="โรคอ้วนระดับอันตราย"
15+
else :
16+
result="ไม่ทราบค่าที่ชัดเจน"
17+
18+
print("ค่า bmi = ", bmi ,"ทำนายว่า =",result)

Diff for: Phase1/EP23.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
name="11504566"
2+
3+
if name.endswith("0"):
4+
print("ถูกหวย")
5+
else :
6+
print("ไม่ถูกหวย")

Diff for: Phase1/EP24.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#แปลงอุณหภูมิ
2+
temp = input("ป้อนอุณหภูมิ (องศา) :") #45C
3+
4+
degree= int(temp[:-1]) #45
5+
unit=temp[-1].upper() #C
6+
7+
8+
if unit=="C":
9+
result=(9*degree)/5+32
10+
unit_result="ฟาเรนไฮน์"
11+
if unit=="F":
12+
result=(degree-32)*5/9
13+
unit_result="เซลเซียส"
14+
15+
print("แปลงตัวเลข = ",temp," เป็น ",unit_result," = ",result)

Diff for: Phase1/EP25.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# โครงสร้างควบคุมแบบทำซ้ำ
2+
summation=0
3+
4+
for i in range(1,11): # summation
5+
print("รอบที่ = ",i)
6+
7+
print("ผลรวม = ", summation)
8+
print("เฉลี่ย = ", summation/10)

Diff for: Phase1/EP26.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Loop ซ้อน Loop
2+
i=1
3+
while i<=3 :
4+
j=1 # ตัวนับ
5+
while j<=5:
6+
print("รอบที่ = ",i," ตำแหน่งที่ = ", j)
7+
j+=1
8+
i+=1
9+
10+
11+
for i in range(1,4):
12+
print("รอบที่ = ",i)
13+
for j in range(1,6):
14+
print("ตำแหน่งที่ = ", j)

Diff for: Phase1/EP27.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# แม่สูตรคูณ
2+
3+
start=int(input("ป้อนแม่สูตรคูณเริ่มต้น = ")) # 1
4+
stop=int(input("ป้อนแม่สูตรคูณสุดท้าย = ")) # 4
5+
6+
for x in range(start,stop+1):
7+
print("แม่ = ",x)
8+
for y in range(1,13):
9+
print(x,'x',y ," = ",(x*y))

Diff for: Phase1/EP28.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# break / continue
2+
3+
for i in range(1,11):
4+
print(i)
5+
if(i==5):
6+
break
7+
8+
print("จบโปรแกรม")

Diff for: Phase1/EP29.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
start , stop = 1,3
2+
sum ,avg =0,0
3+
while (start<=stop):
4+
number=int(input("ป้อนตัวเลขของคุณ :"))
5+
sum+=number # บวกเลขที่ป้อนแต่ละรอบ
6+
start+=1
7+
8+
avg=sum/stop
9+
print("ผลรวม = ", sum)
10+
print("ค่าเฉลี่ย = ", avg)

Diff for: Phase1/EP3.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#string => ข้อความ ตัวอักษร ' "" '''
2+
#number => integer , float
3+
#boolean => true , false
4+
print(-1)
5+
print(0)
6+
print("1"+"9")
7+
print(3.99)
8+
print(True)
9+
print(False)
10+
print("kongruksiam \n" + "studio")

Diff for: Phase1/EP30.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
sum = 0
2+
while True:
3+
number=int(input("ป้อนตัวเลขของคุณ :"))
4+
sum+=number # บวกเลขที่ป้อนแต่ละรอบ
5+
if sum>=100:
6+
break
7+
print("ผลรวม = ", sum)

Diff for: Phase1/EP31.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# ค้นหาตัวเลข มากสุด / น้อยสุด
2+
3+
max ,min = 0,9999
4+
5+
while True :
6+
number=int(input("ป้อนตัวเลขของคุณ :"))
7+
#กระโดดออกจาก loop
8+
if number<0 :
9+
break
10+
if number>max :
11+
max=number
12+
if number<min:
13+
min=number
14+
15+
print("ค่าสูงสุด = ", max)
16+
print("ค่าต่ำสุด = ",min)

Diff for: Phase1/EP32.py

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# ตัวเลขขั้นบันได
2+
3+
"""
4+
input = 10
5+
6+
1
7+
12
8+
123
9+
1234
10+
12345
11+
123456
12+
13+
"""
14+
15+
last=int(input("ป้อนตัวเลข = "))
16+
17+
for row in range(1,last+1):
18+
for column in range(1,row+1):
19+
print(column,end='')
20+
print(" ")
21+
22+
"""
23+
input = 3
24+
25+
row = 1 , 3
26+
column 1,2
27+
1
28+
29+
row 2
30+
column 1, 3
31+
12
32+
33+
row 3
34+
column 1,4
35+
123
36+
37+
"""

0 commit comments

Comments
 (0)