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