AroogzBaba's Posts
Nairaland Forum › AroogzBaba's Profile › AroogzBaba's Posts
1 (of 1 pages)
You do not need the SAQA for your Postgraduate application to UCT. However, I would say it doesn't hurt to have it done as I guess it should come in handy in the long-term. Adewole17: |
Hello everyone, Anyone resuming at UCT this Jan/Feb? |
#Please I need help with this. The code passes all the visible test but fails hidden test #Thanks class BankAccount: def withdraw(): pass def deposit(): pass class SavingsAccount(BankAccount): def __init__(self): #if self.balance != 500: #raise ValueError() self.balance = 500 @property def balance(self): return self.__balance @balance.setter def balance(self, amount): if type(amount) == int or type(amount) == float: if amount >= 500: self.__balance = amount else: return else: raise ValueError() def deposit(self, amount): if type(amount) == int or type(amount) == float: if amount < 0: return "Invalid deposit amount" self.balance += amount return self.balance else: raise ValueError() def withdraw(self, amount): if type(amount) == int or type(amount) == float: if amount < 0: return "Invalid withdraw amount" elif amount > self.balance: return "Cannot withdraw beyond the current account balance" elif (self.balance - amount) < 500: return "Cannot withdraw beyond the minimum account balance" self.balance -= amount return self.balance else: raise ValueError() class CurrentAccount(BankAccount): def __init__(self): self.balance = 0 @property def balance(self): return self._balance @balance.setter def balance(self, amount): if type(amount) == int or type(amount) == float: if amount >= 0: self._balance = amount else: return else: raise ValueError() def deposit(self, amount): if type(amount) == int or type(amount) == float: if amount < 0: return "Invalid deposit amount." self.balance += amount return self.balance else: raise ValueError() def withdraw(self, amount): if type(amount) == int or type(amount) == float: if amount < 0: return "Invalid withdraw amount" elif self.balance < amount: return "Cannot withdraw beyond the current account balance" else: self.balance -= amount return self.balance else: raise ValueError() |
1 (of 1 pages)