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