Grade letter · เกรดตัวอักษร
Grade letter
mark is 72. Print A for 80 and above, B for 70 to 79, C for 60 to 69, and D below that.
Order matters. Because Python stops at the first true test, checking >= 60 first would give C to every good mark. Start at the top and work down.
حرفเกรด
mark คือ 72. พิมพ์ A สำหรับ 80 ขึ้นไป, B สำหรับ 70 ถึง 79, C สำหรับ 60 ถึง 69, และ D ต่ำกว่านั้น
ลำดับมีความสำคัญ เพราะ Python หยุดที่การทดสอบที่เป็นจริงครั้งแรก หากเริ่มตรวจสอบ >= 60 ก่อน จะทำให้คะแนนดีทุกคะแนนถูกจัดอยู่ในกลุ่ม C ควรเริ่มจากบนลงล่าง
mark is 72. Print A for 80 and above, B for 70 to 79, C for 60 to 69, and D below that. · mark คือ 72. พิมพ์ A สำหรับ 80 ขึ้นไป, B สำหรับ 70 ถึง 79, C สำหรับ 60 ถึง 69, และ D ต่ำกว่านั้น
Click Run to see the output here. · คลิก Run เพื่อดูผลลัพธ์ที่นี่