Skip to content · ⁨ข้ามไปยังเนื้อหา⁩

Bank account · ⁨บัญชีธนาคาร⁩

English

Bank account

A tiny bank that follows a list of instructions and never lets the balance go below zero.

"deposit 50".split() breaks the string at its spaces into ["deposit", "50"]. The amount is still text, so convert it with int(). Check that there is enough money before a withdrawal changes the balance; a refused withdrawal simply does nothing.

ไทย

บัญชีธนาคาร

ระบบจำลองธนาคารขนาดเล็กที่ปฏิบัติตามรายการคำสั่งและไม่อนุญาตให้ยอดเงินติดลบ

"deposit 50".split() ตัดสตริงที่ช่องว่างออกเป็น ["deposit", "50"] ส่วนจำนวนเงินยังคงเป็นข้อความ所以需要ใช้ int() แปลงชนิดข้อมูล ตรวจสอบว่ามีเงินเพียงพอ ก่อน การถอนเงินจะลดยอดเงิน; การถอนเงินที่ไม่ผ่านจะไม่เกิดผลใดๆ

Log in or create account · ⁨เข้าสู่ระบบหรือสร้างบัญชี⁩

IGCSE, A-Level & AP