Example 1 — Exam Score Analysis ตัวอย่างที่ 1 — วิเคราะห์คะแนนสอบ

A worked problem: read ten exam marks, then report the class average, how many students passed, and the highest mark, and finally judge the class. โจทย์ตัวอย่าง: รับคะแนนสอบ 10 คน แล้วรายงานค่าเฉลี่ยของชั้น จำนวนคนที่สอบผ่าน และคะแนนสูงสุด สุดท้ายสรุปผลของชั้นเรียน

Exam Score Analysis วิเคราะห์คะแนนสอบ
1 The problem โจทย์

A class has 10 students. Read each student's exam mark (a whole number from 0 to 100) and store the marks in a list. Then produce three results using three user-defined functions:

ชั้นเรียนมีนักเรียน 10 คน ให้รับคะแนนสอบของแต่ละคน (จำนวนเต็ม 0 ถึง 100) แล้วเก็บคะแนนไว้ในลิสต์ จากนั้นสร้างผลลัพธ์ 3 อย่างด้วยฟังก์ชันที่นิยามเอง 3 ตัว:

  • find_average(marks) — the class average (total ÷ N)
  • count_passes(marks) — how many marks are ≥ 50 (a pass)
  • find_highest(marks) — the single highest mark
  • find_average(marks) — ค่าเฉลี่ยของชั้น (ผลรวม ÷ N)
  • count_passes(marks) — จำนวนคะแนนที่ ≥ 50 (ถือว่าผ่าน)
  • find_highest(marks) — คะแนนสูงสุดเพียงค่าเดียว

Finally, print "Good class performance" when the average is >= 70 and the number of passes is >= 8; otherwise print "Needs improvement".

สุดท้าย ให้พิมพ์ "Good class performance" เมื่อค่าเฉลี่ย >= 70 และ จำนวนคนที่ผ่าน >= 8; ถ้าไม่เข้าเงื่อนไข ให้พิมพ์ "Needs improvement"

Ideas used: a counting loop (for / while), a list, user-defined functions (def / return), an accumulator (Total), a running maximum (Highest), and a compound if condition with and.

แนวคิดที่ใช้: loop นับรอบ (for / while), list, ฟังก์ชันที่นิยามเอง (def / return), ตัวสะสมค่า (Total), ตัวเก็บค่ามากสุดระหว่างวน (Highest) และเงื่อนไข if แบบรวมด้วย and

2 Main program — flowchart explanation โปรแกรมหลัก — คำอธิบาย flowchart

The program starts by setting i = 0 as the data counter (after 10 values it moves on to the next step) and creating a list marks to hold the scores. Next it checks whether i < 10; if it is, an input asks the user for a number 0–100, then the entered number is added to marks with append, i is increased by 1, and control goes back to test i again. This repeats until i < 10 is false, so it leaves the loop. Then it finds the average score, the number of passing scores, and the highest score using the sub-functions find_average, count_passes, and Find_highest in turn. When every value is computed it shows the results with print. After that it checks whether the average is >= 70 and the number of passes is >= 8; if so it uses print for the message "Good class performance", otherwise it prints "Needs improvement", and the program ends.

โปรแกรมนี้เริ่มต้นด้วยกำหนดค่า i = 0 เป็นตัวนับจำนวนข้อมูล (เมื่อรับค่าครบ 10 ครั้งแล้วทำงานขั้นตอนถัดไป) และสร้างตัวแปรสำหรับเก็บคะแนนมีชื่อว่า marks ถัดไปตรวจสอบเงื่อนไขว่า i < 10 หรือไม่ ถ้าน้อยกว่าสร้าง input ให้ผู้ใช้กรอกตัวเลข 0–100 แล้วเพิ่มตัวเลขที่ผู้ใช้ป้อนเข้ามาไปเก็บที่ตัวแปร marks ด้วยคำสั่ง append ถัดไปเพิ่มค่า i ขึ้น 1 แล้วกลับไปตรวจสอบค่า i อีกครั้ง ทำแบบนี้จน i < 10 เป็นเท็จ จึงออกจาก loop แล้วทำการหาค่าคะแนนเฉลี่ย จำนวนคะแนนที่ผ่าน และคะแนนสูงสุดด้วย function ย่อย ชื่อ find_average, count_passes และ Find_highest ตามลำดับ เมื่อคำนวณทุกค่าเสร็จแล้วแสดงผลลัพธ์ด้วยคำสั่ง print หลังจากนั้นตรวจสอบค่าเฉลี่ยว่า มากกว่าเท่ากับ 70 และจำนวนที่ผ่านมากกว่าเท่ากับ 8 หรือไม่ ถ้าใช่ให้ print ข้อความ "Good class performance" แต่ถ้าไม่ให้ print ข้อความ "Needs improvement" แล้วจบการทำงานของโปรแกรม

Start i = 0 loop i<10 No Yes Input: number (0-100) i++ stores the marks in a list Average_value = find_average(marks) Number_of_passes = count_passes(marks) Highest_value = Find_highest(marks) Output: Average_value, Number_of_passes, Highest_value Average_value >= 70 & Number_of_passes >= 8 Yes No Output: “Needs improvement” Output: “Good class performance” Stop
The runnable code below asks for the 10 marks with input(), exactly like the flowchart. Edit the ten numbers after the 1: … 10: labels in the [input] box, then press Run. โค้ดที่รันได้ด้านล่างรับคะแนน 10 ค่าด้วย input() ตรงตาม flowchart แก้ตัวเลขทั้ง 10 ค่าหลังเลข 1: … 10: ในกล่อง [input] แล้วกด Run
[main]
[input]
[output]
Enter mark 1 (0-100): 82
Enter mark 2 (0-100): 47
Enter mark 3 (0-100): 90
Enter mark 4 (0-100): 66
Enter mark 5 (0-100): 51
Enter mark 6 (0-100): 73
Enter mark 7 (0-100): 88
Enter mark 8 (0-100): 40
Enter mark 9 (0-100): 95
Enter mark 10 (0-100): 78
Average: 71.00
Passes: 8
Highest: 95
Good class performance
3 find_average(marks)

This function starts by setting Total = 0 as an accumulator and N = len(marks) as the number of scores, and i = 0 as the counter. Next it checks whether i < len(marks); if it is, it takes mark = marks[i], adds it into Total, then increases i by 1 and goes back to test i again. This repeats until i < len(marks) is false, so it leaves the loop and computes Average_value = Total / N, then sends that value back with return.

ฟังก์ชันนี้เริ่มต้นด้วยกำหนดค่า Total = 0 เป็นตัวสะสมค่า และ N = len(marks) เป็นจำนวนคะแนน กับ i = 0 เป็นตัวนับ ถัดไปตรวจสอบเงื่อนไขว่า i < len(marks) หรือไม่ ถ้าน้อยกว่าให้ดึง mark = marks[i] บวกเข้าไปที่ Total แล้วเพิ่มค่า i ขึ้น 1 แล้วกลับไปตรวจสอบค่า i อีกครั้ง ทำแบบนี้จน i < len(marks) เป็นเท็จ จึงออกจาก loop แล้วคำนวณ Average_value = Total / N แล้วส่งค่านี้กลับด้วยคำสั่ง return

find_average(marks) Total = 0, N = len(marks) i = 0 loop i<len(marks) No Yes mark = marks[i] Total+=mark i++ Average_value = Total/N Return Average_value
Total is an accumulator: it starts at 0 and each mark is added in. Total เป็น ตัวสะสมค่า: เริ่มที่ 0 แล้วบวกคะแนนทีละค่าเข้าไป

Run just this function on the fixed list:

ลองรันเฉพาะฟังก์ชันนี้กับลิสต์ค่าคงที่:

[demo]
[output]
71.0
4 count_passes(marks)

This function starts by setting count_passes = 0 as a counter and i = 0 as the index. Next it checks whether i < len(marks); if it is, it takes mark = marks[i] and checks whether mark >= 50; if yes it increases count_passes by 1, if no it does nothing. Then it increases i by 1 and goes back to test i again. This repeats until i < len(marks) is false, so it leaves the loop and sends count_passes back with return.

ฟังก์ชันนี้เริ่มต้นด้วยกำหนดค่า count_passes = 0 เป็นตัวนับ และ i = 0 เป็นดัชนี ถัดไปตรวจสอบเงื่อนไขว่า i < len(marks) หรือไม่ ถ้าน้อยกว่าให้ดึง mark = marks[i] แล้วตรวจสอบว่า mark >= 50 หรือไม่ ถ้าใช่ให้เพิ่มค่า count_passes ขึ้น 1 ถ้าไม่ใช่ไม่ต้องทำอะไร จากนั้นเพิ่มค่า i ขึ้น 1 แล้วกลับไปตรวจสอบค่า i อีกครั้ง ทำแบบนี้จน i < len(marks) เป็นเท็จ จึงออกจาก loop แล้วส่งค่า count_passes กลับด้วยคำสั่ง return

count_passes(marks) count_passes = 0 i = 0 loop i<len(marks) No Yes mark = marks[i] Mark>=50? Yes No count_passes+=1 i++ Return count_passes
count_passes is a counter: it only goes up, and it goes up when a mark is 50 or more. count_passes เป็น ตัวนับ: เพิ่มขึ้นเท่านั้น และเพิ่มเมื่อคะแนน ≥ 50
[demo]
[output]
8
5 find_highest(marks)

This function starts by setting Highest = -inf (negative infinity) as the running maximum, so the very first mark is always bigger, and i = 0 as the index. Next it checks whether i < len(marks); if it is, it takes mark = marks[i] and checks whether mark > Highest; if yes it updates Highest = mark, if no it keeps the old value. Then it increases i by 1 and goes back to test i again. This repeats until i < len(marks) is false, so it leaves the loop and sends Highest_value back with return.

ฟังก์ชันนี้เริ่มต้นด้วยกำหนดค่า Highest = -inf (ลบอนันต์) เป็นตัวเก็บค่ามากสุด เพื่อให้คะแนนตัวแรกมากกว่าเสมอ และ i = 0 เป็นดัชนี ถัดไปตรวจสอบเงื่อนไขว่า i < len(marks) หรือไม่ ถ้าน้อยกว่าให้ดึง mark = marks[i] แล้วตรวจสอบว่า mark > Highest หรือไม่ ถ้าใช่ให้ปรับ Highest = mark ถ้าไม่ใช่คงค่าเดิม จากนั้นเพิ่มค่า i ขึ้น 1 แล้วกลับไปตรวจสอบค่า i อีกครั้ง ทำแบบนี้จน i < len(marks) เป็นเท็จ จึงออกจาก loop แล้วส่งค่า Highest_value กลับด้วยคำสั่ง return

Note: the source diagram labels the end box "Return count_passes" — that is a slip. This function returns the highest mark, so the box below reads return Highest_value.

หมายเหตุ: แผนภาพต้นฉบับเขียนกล่องท้ายว่า "Return count_passes" ซึ่งเป็นการพิมพ์ผิด ฟังก์ชันนี้ส่งค่าคะแนนสูงสุดกลับ กล่องด้านล่างจึงเป็น return Highest_value

Find_highest(marks) Highest = -inf i = 0 loop i<len(marks) No Yes mark = marks[i] mark>Highest Yes No Update Highest : Highest = mark i++ Return Highest_value
Highest is a running maximum: it changes when a bigger mark appears. Highest เป็น ค่ามากสุดระหว่างวน: เปลี่ยนเมื่อเจอคะแนนที่มากกว่า
[demo]
[output]
95

Note: Run on this page is a JavaScript simulation, not real Python. For real Python, try Google Colab.

หมายเหตุ: การกด Run บนหน้านี้เป็นการจำลองด้วย JavaScript ไม่ใช่ Python จริง หากต้องการทดลอง Python จริง แนะนำ Google Colab

References อ้างอิง

End-of-lesson quizแบบฝึกหัดท้ายบท

ตอบแล้ว 0 / 10

ข้อ 1

1 / 10

How many exam marks does the main program read?โปรแกรมหลักรับคะแนนสอบทั้งหมดกี่ค่า?

เฉลย / Answerซ่อนเฉลย / Hide

เฉลย / Answer: (A) 10 marks (loop i < 10)10 ค่า (loop i < 10)

คำอธิบายแต่ละตัวเลือก / Explanation for each choice

  • (A) 10 marks (loop i < 10)10 ค่า (loop i < 10)
    Correct! The loop runs while i < 10, so it reads 10 marks.ถูกต้อง! loop วนขณะ i < 10 จึงรับ 10 ค่า
  • (B) 5 marks5 ค่า
    Wrong: the condition is i < 10, not i < 5.ผิด: เงื่อนไขคือ i < 10 ไม่ใช่ i < 5
  • (C) 100 marks100 ค่า
    Wrong: 0–100 is the range of each mark, not the number of students.ผิด: 0–100 คือช่วงของค่าคะแนนแต่ละค่า ไม่ใช่จำนวนคน
  • (D) Unlimited, until the user stopsไม่จำกัด จนกว่าผู้ใช้จะหยุด
    Wrong: the counting loop with i has a clear bound of 10.ผิด: loop นับรอบด้วย i มีขอบเขตชัดเจนที่ 10

ข้อ 2

2 / 10

When does a mark count as a 'pass'?คะแนนนับว่า 'ผ่าน' เมื่อใด?

เฉลย / Answerซ่อนเฉลย / Hide

เฉลย / Answer: (B) When Mark >= 50เมื่อ Mark >= 50

คำอธิบายแต่ละตัวเลือก / Explanation for each choice

  • (A) Only when Mark > 50เมื่อ Mark > 50 เท่านั้น
    Wrong: the condition is Mark >= 50 (50 included).ผิด: เงื่อนไขในโจทย์คือ Mark >= 50 (รวม 50)
  • (B) When Mark >= 50เมื่อ Mark >= 50
    Correct! In the count_passes flowchart the test is Mark >= 50.ถูกต้อง! ตาม flowchart ของ count_passes คือ Mark >= 50
  • (C) When Mark == 100เมื่อ Mark == 100
    Wrong: it need not be 100; >= 50 is a pass.ผิด: ไม่ต้องเต็ม 100 แค่ >= 50 ก็ผ่าน
  • (D) When Mark < 50เมื่อ Mark < 50
    Wrong: that is a failing mark.ผิด: นั่นคือคะแนนที่ไม่ผ่าน

ข้อ 3

3 / 10

What does count_passes(marks) return?count_passes(marks) ส่งค่าอะไรกลับ?

เฉลย / Answerซ่อนเฉลย / Hide

เฉลย / Answer: (C) The number of marks that are ≥ 50จำนวนคะแนนที่ ≥ 50

คำอธิบายแต่ละตัวเลือก / Explanation for each choice

  • (A) The average of the marksค่าเฉลี่ยของคะแนน
    Wrong: the average is find_average's job.ผิด: ค่าเฉลี่ยเป็นงานของ find_average
  • (B) The highest markคะแนนสูงสุด
    Wrong: the highest mark is find_highest's job.ผิด: คะแนนสูงสุดเป็นงานของ find_highest
  • (C) The number of marks that are ≥ 50จำนวนคะแนนที่ ≥ 50
    Correct! count_passes counts the marks that pass.ถูกต้อง! count_passes นับคะแนนที่ผ่านเกณฑ์
  • (D) The total of all marksผลรวมของคะแนนทั้งหมด
    Wrong: the total is Total inside find_average.ผิด: ผลรวมคือ Total ใน find_average

ข้อ 4

4 / 10

Why does find_highest start with Highest = -inf?ทำไม find_highest จึงเริ่มด้วย Highest = -inf?

เฉลย / Answerซ่อนเฉลย / Hide

เฉลย / Answer: (D) So the first mark is always greater than Highest and gets storedเพื่อให้คะแนนตัวแรกมากกว่า Highest เสมอ แล้วถูกเก็บไว้

คำอธิบายแต่ละตัวเลือก / Explanation for each choice

  • (A) Because the lowest possible mark is -infเพราะคะแนนต่ำสุดที่เป็นไปได้คือ -inf
    Wrong: marks are 0–100; -inf is just a starting value.ผิด: คะแนนอยู่ในช่วง 0–100 -inf เป็นเพียงค่าตั้งต้น
  • (B) To force the loop to run 100 timesเพื่อบังคับให้ลูปวน 100 รอบ
    Wrong: the number of rounds depends on len(marks).ผิด: จำนวนรอบขึ้นกับ len(marks)
  • (C) To make the result always a decimalเพื่อให้ผลลัพธ์เป็นทศนิยมเสมอ
    Wrong: it is not about the result type.ผิด: ไม่เกี่ยวกับชนิดผลลัพธ์
  • (D) So the first mark is always greater than Highest and gets storedเพื่อให้คะแนนตัวแรกมากกว่า Highest เสมอ แล้วถูกเก็บไว้
    Correct! A very small start value means the first mark wins the comparison.ถูกต้อง! ค่าตั้งต้นที่เล็กมากทำให้ mark แรกชนะการเปรียบเทียบ

ข้อ 5

5 / 10

How does find_average(marks) compute the average?find_average(marks) คำนวณค่าเฉลี่ยอย่างไร?

เฉลย / Answerซ่อนเฉลย / Hide

เฉลย / Answer: (A) Total / N where Total is the sum and N is the number of marksTotal / N โดย Total คือผลรวม และ N คือจำนวนคะแนน

คำอธิบายแต่ละตัวเลือก / Explanation for each choice

  • (A) Total / N where Total is the sum and N is the number of marksTotal / N โดย Total คือผลรวม และ N คือจำนวนคะแนน
    Correct! In the flowchart, Average_value = Total / N.ถูกต้อง! ตาม flowchart Average_value = Total / N
  • (B) Total * NTotal * N
    Wrong: the average is a division, not a multiplication.ผิด: ค่าเฉลี่ยคือหาร ไม่ใช่คูณ
  • (C) The highest mark minus the lowest markคะแนนสูงสุดลบคะแนนต่ำสุด
    Wrong: that is the range, not the average.ผิด: นั่นคือช่วง (range) ไม่ใช่ค่าเฉลี่ย
  • (D) The last mark in the listคะแนนตัวสุดท้ายใน list
    Wrong: you must sum all values and divide by the count.ผิด: ต้องรวมทุกค่าแล้วหารด้วยจำนวน

ข้อ 6

6 / 10

When does the program print "Good class performance"?โปรแกรมพิมพ์ "Good class performance" เมื่อใด?

เฉลย / Answerซ่อนเฉลย / Hide

เฉลย / Answer: (B) When the average is ≥ 70 and the number of passes is ≥ 8เมื่อค่าเฉลี่ย ≥ 70 และ จำนวนคนที่ผ่าน ≥ 8

คำอธิบายแต่ละตัวเลือก / Explanation for each choice

  • (A) When the average is ≥ 70 or the number of passes is ≥ 8เมื่อค่าเฉลี่ย ≥ 70 หรือ จำนวนคนที่ผ่าน ≥ 8
    Wrong: the condition uses and, not or.ผิด: เงื่อนไขใช้ and ไม่ใช่ or
  • (B) When the average is ≥ 70 and the number of passes is ≥ 8เมื่อค่าเฉลี่ย ≥ 70 และ จำนวนคนที่ผ่าน ≥ 8
    Correct! Both conditions must be true (and).ถูกต้อง! ต้องจริงทั้งสองเงื่อนไข (and)
  • (C) When the highest mark is 100เมื่อคะแนนสูงสุดเป็น 100
    Wrong: the decision does not use the highest value.ผิด: การตัดสินใจไม่ใช้ค่าสูงสุด
  • (D) Every time the program finishesทุกครั้งที่โปรแกรมรันเสร็จ
    Wrong: it depends on the condition's result.ผิด: ขึ้นกับผลของเงื่อนไข

ข้อ 7

7 / 10

If the average = 68 and the number of passes = 9, what does the program print?ถ้าค่าเฉลี่ย = 68 และจำนวนคนที่ผ่าน = 9 โปรแกรมพิมพ์อะไร?

เฉลย / Answerซ่อนเฉลย / Hide

เฉลย / Answer: (C) Needs improvementNeeds improvement

คำอธิบายแต่ละตัวเลือก / Explanation for each choice

  • (A) Good class performanceGood class performance
    Wrong: both must hold, but 68 < 70.ผิด: ต้องจริงทั้งสองเงื่อนไข แต่ 68 < 70
  • (B) Both messagesทั้งสองข้อความ
    Wrong: if/else prints only one message.ผิด: if/else พิมพ์เพียงข้อความเดียว
  • (C) Needs improvementNeeds improvement
    Correct! The and is false because 68 < 70, so else runs.ถูกต้อง! เงื่อนไข and เป็นเท็จเพราะ 68 < 70 จึงเข้า else
  • (D) Nothingไม่พิมพ์อะไร
    Wrong: the else branch always prints when the condition is false.ผิด: มีสาขา else ที่พิมพ์เสมอเมื่อเงื่อนไขเป็นเท็จ

ข้อ 8

8 / 10

In the main program, when i < 10 is false, what does it mean?ในโปรแกรมหลัก เมื่อ i < 10 เป็นเท็จ หมายความว่าอะไร?

เฉลย / Answerซ่อนเฉลย / Hide

เฉลย / Answer: (D) The input loop is finished (all 10 read); the program moves on to the calculationsloop รับข้อมูลจบแล้ว (รับครบ 10 ค่า) โปรแกรมไปคำนวณต่อ

คำอธิบายแต่ละตัวเลือก / Explanation for each choice

  • (A) An error occurred while reading marksเกิดข้อผิดพลาดในการรับคะแนน
    Wrong: a false condition is normal once i reaches 10.ผิด: เงื่อนไขเป็นเท็จเป็นเรื่องปกติเมื่อ i ถึง 10
  • (B) You must start reading marks again from the beginningต้องเริ่มรับคะแนนใหม่ตั้งแต่ต้น
    Wrong: the loop is done; it does not restart.ผิด: loop จบแล้ว ไม่วนกลับ
  • (C) The highest mark is 10คะแนนสูงสุดคือ 10
    Wrong: 10 is the number of rounds, not a mark.ผิด: 10 คือจำนวนรอบ ไม่ใช่คะแนน
  • (D) The input loop is finished (all 10 read); the program moves on to the calculationsloop รับข้อมูลจบแล้ว (รับครบ 10 ค่า) โปรแกรมไปคำนวณต่อ
    Correct! It passes through connector 2 to page 2 to call the functions.ถูกต้อง! ผ่าน connector 2 ไปหน้า 2 เพื่อเรียกฟังก์ชัน

ข้อ 9

9 / 10

Why split find_average, count_passes, find_highest into functions (sub-charts) instead of one big main flow?ทำไมจึงแยก find_average, count_passes, find_highest เป็นฟังก์ชัน (sub-chart) แทนที่จะเขียนรวมใน flow หลัก?

เฉลย / Answerซ่อนเฉลย / Hide

เฉลย / Answer: (B) So each task is readable, testable on its own, and reusableเพื่อให้แต่ละงานอ่านง่าย ทดสอบแยกได้ และนำกลับมาใช้ซ้ำได้

คำอธิบายแต่ละตัวเลือก / Explanation for each choice

  • (A) Because Python requires every loop to be in a functionเพราะ Python บังคับให้ทุกลูปอยู่ในฟังก์ชัน
    Wrong: loops can be outside functions.ผิด: ลูปอยู่นอกฟังก์ชันได้
  • (B) So each task is readable, testable on its own, and reusableเพื่อให้แต่ละงานอ่านง่าย ทดสอบแยกได้ และนำกลับมาใช้ซ้ำได้
    Correct! Splitting into sub-functions keeps the main flow short and clear.ถูกต้อง! การแบ่งเป็นฟังก์ชันย่อยทำให้ flow หลักสั้นและชัด
  • (C) Because functions always run faster than plain codeเพราะฟังก์ชันทำงานเร็วกว่าโค้ดปกติเสมอ
    Wrong: the main reason is clarity and reuse, not speed.ผิด: เหตุผลหลักคือความชัดเจนและการใช้ซ้ำ ไม่ใช่ความเร็ว
  • (D) Because a flowchart may not have more than one pageเพราะ flowchart ห้ามมีมากกว่า 1 หน้า
    Wrong: a flowchart can have several pages and sub-charts.ผิด: flowchart มีหลายหน้าและ sub-chart ได้

ข้อ 10

10 / 10

In the main program, what does marks.append(number) do inside the loop?ในโปรแกรมหลัก marks.append(number) ในลูปทำอะไร?

เฉลย / Answerซ่อนเฉลย / Hide

เฉลย / Answer: (C) Adds the just-read mark to the end of the list marksเพิ่มคะแนนที่เพิ่งรับเข้ามาไว้ท้าย list marks

คำอธิบายแต่ละตัวเลือก / Explanation for each choice

  • (A) Replaces the whole list with just numberแทนที่ทั้ง list ด้วยค่า number ค่าเดียว
    Wrong: append adds a value; it does not replace the list.ผิด: append เพิ่มค่า ไม่ได้แทนที่ list
  • (B) Removes the last value from the listลบค่าสุดท้ายออกจาก list
    Wrong: removing is not what append does.ผิด: การลบไม่ใช่หน้าที่ของ append
  • (C) Adds the just-read mark to the end of the list marksเพิ่มคะแนนที่เพิ่งรับเข้ามาไว้ท้าย list marks
    Correct! Each round of the loop stores one mark into the list.ถูกต้อง! ทุกรอบของลูปจะเก็บคะแนน 1 ค่าเข้า list
  • (D) Sorts the marks in the list from high to lowเรียงคะแนนใน list จากมากไปน้อย
    Wrong: append does not sort.ผิด: append ไม่จัดเรียง