Python M.2

24

311

1

Black cat_BC.

Black cat_BC.

มัธยมต้น 2

สรุปเนื้อหา python ในม.2 ทั้งหมด

ความคิดเห็น

ภัทราพร
ภัทราพร

😻

ノートテキスト

ページ1:

EL
PYTHON BASIC
หลักการกำาหนดค่าตัวแปร
P = 1
e = a = c = 2
ดังนั้น p = 1 e = 2
=
ตัวแปรจะเขียนเป็นอะไรก็ได้ แต่ๆๆ
ขึ้นต้นด้วยตัวเลข X
มีอักขระพิเศษ
X
ตั้งชื่อซ้ำกับคำสงวน X
มีช่องว่าง X
มี 2 (underscore)
-
ขึ้นต้นด้วยตัวอักษร
ขึ้นต้นด้วย
=
Print = คำสั่งที่ควรมีในการ
เขียนโค๊ด สั่ง print จะเท่ากับ
สั่งให้แสดงผล
ถ้าไม่สั่ง print จะไม่มีอะไรออก
pause function (e) {
(this paused true)
if (this Seloment.find("next, prev").length
this.Selement.trigger($.support.transition
this.cycle(true)
1 = Squates
this.interval
returns this
clear Interval(this.i
his.interval)
Carousal prototype.next-Function () {
1
if (this.sliding) return
return this.sta
.slide('next")
Carousel.prototype
if (this.sliding) function () {
return
niturn this.slide('prev")
Carousel.prototype.slide function (type, next
this.Selevent.find("item.art
this.getItenForDirect
neart
var isCycling this.interval
type 'next "left" "r
wer fallhack type 'next"'"first"
this
if ($rest-length) {
if(this.options.wrap) retur
this. Selement.find('.ites')[fallbar
ver Sactive
405
406
407
A08
wr direc
s_Method'}} 52
Teethod']) &&
s_eethod']['code"]
410
411
412
413
Snext
Ipa']['
414
415
416
417
418
419
chipping methods");
428
471
422
if (next.hasClass{"active"]} return (this.st
var relatedfarget $next[]
slideEvent - S.Event{'slide.bs.carousel
relatedTarget; relatedTarget,
direction: direction
this Calament trinner/slidefiant)
Note.
ตัวแปร คือ กล่องเก็บข้อมูล
คือ การใส่ของลงกล่อง
print คือ การเปิดดูว่าใส่อะไรไว้
ถ้าเขียนตัวแปร พิมพเล็ก/พิมพ์ใหญ่
จะถือว่าเป็นคนละตัวแปรกัน
Peach, PEACH, peach
นับว่าเป็นคนละตัวกัน
Risi
2

ページ2:

ชนิดของข้อมูล LOOP
int
จํานวนเต็มบวก
Ex. 15,7,9
ถ้าอยากได้คำตอบหรือในโค้ดมีอะไร
เกี่ยวกับตัวเลข ต้องมี int แต่ต้อง
เป็นตัวเลขที่เป็นจำนวนเต็ม
boolean
บูลีน คือ Ture, False
ใช้แสดงผลว่าเป็น จริง
หรือ เท็จ
float
จํานวนจริงหรือทศนิยม
Ex. 7.09, 15.6
list
ลิสต์ – ลิสต์ มีitem(กลุ่มคำ) หรือที่เรียก
กันว่า สมาชิก
เรียกใช้ด้วยเครื่องหมาย [ ] หรือ [:] และ
แยกด้วย,
Ex. ['peach', 'look', 'like', 'cat']
นับช่องคํา คำว่า peach นับว่าเป็น
ช่องที่O ส่วน look เป็นช่องที่ 1 และ
ต่อไปก็ตามลำาดับ
Loop for
ใช้ for i in range():
ใส่ตัวเลขเช่น (1,8) = 1 - 8 (ไม่นับ
เลข8)
ใช้สําหรับรับเลข
Ex. for i in range (1, 8) :
Run
print(i)
1
- 23
14561
7
Run
Ex. i=1
Loop while
กําหนดตัวแปร i = 1
และใช้ while (i..) :
print(i)
i = i+1
while(i<8) :
print(i)
i=i+2
1
3
5
7
i น้อยกว่า 8 คือ
i = 1 และ i < 8
บวกเพิ่มทีละ 2
Risin
s
3
News