A company is opening a bank, but the coder who is designing the user class made some errors. They need  you  to help them. 

You must include the following:

- A withdraw method
  - Subtracts money from balance
  - One parameter, money to withdraw
  - Raise ValueError if there isn't enough money to withdraw
  - Return a string with name and balence(see examples)
  
* A check method
  - Adds money to baleance
  - Two parameters, other user and money
  - Other user will always be valid
  - Raise a ValueError if other user doesn't have enough money
  - Raise a ValueError if checking_account isn't true for other user
  - Return a string with name and balance plus other name and other balance(see examples)
  
- An add_cash method
  - Adds money to balance
  - One parameter, money to add
  - Return a string with name and balance(see examples)

Additional Notes:
  * Checking_account should be stored as a boolean
  - No input numbers will be negitive
  * Output must end with period
  - Float numbers will not be used so, balance should be integer
  * No currency will be used
  
Examples:
``` Python
Jeff = User('Jeff', 70, True)
Joe = User('Joe', 70, False)

Jeff.withdraw(2) # Returns 'Jeff has 68.'

Joe.check(Jeff, 50) # Returns 'Joe has 120 and Jeff has 18.'

Jeff.check(Joe, 80) # Raises a ValueError

Joe.checking_account = True # Enables checking for Joe

Jeff.check(Joe, 80) # Returns 'Jeff has 98 and Joe has 40'

Joe.check(Jeff, 100) # Raises a ValueError

Jeff.add_cash(20.00) # Returns 'Jeff has 118.'
```

 Good Luck

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def __init__(self, name, balance, checking_account):
	

Solutions:
class User(object):

	def __init__(self, name, balance, checking_account):
		self.name = name
		self.balance = balance
		self.checking_account = checking_account

	def withdraw(self, v):
		if v > self.balance:
			raise ValueError()
		self.balance -= v
		return '{} has {}.'.format(self.name, int(self.balance))

	def add_cash(self, v):
		self.balance += v
		return '{} has {}.'.format(self.name, int(self.balance))

	def check(self, other, v):
		if not other.checking_account:
			raise ValueError()
		(s1, s2) = (other.withdraw(v), self.add_cash(v)[:-1])
		return '{} and {}'.format(s2, s1)

	def __str__(self):
		return 'User({}, {}, {})'.format(self.name, self.balance, self.checking_account)


class User:

	def __init__(self, name, balance, checking_account):
		(self.name, self.balance, self.checking_account) = (name, balance, checking_account)

	def __str__(self):
		return '{} has {:d}.'.format(self.name, self.balance)

	def withdraw(self, amount):
		if self.balance < amount:
			raise ValueError('Not enough money.')
		self.balance -= amount
		return str(self)

	def add_cash(self, amount):
		self.balance += amount
		return str(self)

	def check(self, other, amount):
		if not other.checking_account:
			raise ValueError("Can't transfer money from this account.")
		other.withdraw(amount)
		self.add_cash(amount)
		return '{} and {}'.format(str(self)[:-1], other)


class User(object):

	def __init__(self, name, balance, checking_account):
		self.name = name
		self.balance = balance
		self.checking_account = checking_account

	def withdraw(self, wd):
		if not wd > self.balance:
			self.balance -= wd
			return f'{self.name} has {self.balance}.'
		raise f"{self.name} can't withdraw {wd}, he only has {self.balance}."

	def check(self, other, dd):
		if other.checking_account:
			if dd > other.balance:
				raise ValueError
			self.balance += dd
			other.balance -= dd
			return f'{self.name} has {self.balance} and {other.name} has {other.balance}.'
		raise f"{other.name} doesn't have enough money."

	def add_cash(self, ad):
		self.balance += ad
		return f'{self.name} has {self.balance}.'


class User(object):

	def __init__(self, name, balance, checking_account):
		self.name = name
		self.balance = balance
		self.checking_account = checking_account

	def withdraw(self, money):
		if self.balance < money:
			raise ValueError
		self.balance -= money
		return self.name + ' has ' + str(self.balance) + '.'

	def check(self, other, money):
		if other.balance < money:
			raise ValueError
		if not other.checking_account:
			raise ValueError
		other.balance -= money
		self.balance += money
		return self.name + ' has ' + str(self.balance) + ' and ' + other.name + ' has ' + str(other.balance) + '.'

	def add_cash(self, money):
		self.balance += money
		return self.name + ' has ' + str(self.balance) + '.'


class User(object):

	def __init__(self, name, balance, checking_account):
		self.name = name
		self.balance = int(balance)
		self.checking_account = checking_account

	def withdraw(self, amount):
		if amount > self.balance:
			raise ValueError
		self.balance = int(self.balance - amount)
		return f'{self.name} has {self.balance}.'

	def check(self, other, amount):
		if not other.checking_account or amount > other.balance:
			raise ValueError
		other.balance = int(other.balance - amount)
		self.balance = int(self.balance + amount)
		return f'{self.name} has {self.balance} and {other.name} has {other.balance}.'

	def add_cash(self, amount):
		self.balance = int(self.balance + amount)
		return f'{self.name} has {self.balance}.'


class User(object):

	def __init__(self, name, balance, checking_account):
		self.name = name
		self.balance = balance
		self.checking_account = checking_account

	def withdraw(self, money):
		if self.balance < money:
			raise ValueError('Not enough balance')
		self.balance -= money
		return '{} has {}.'.format(self.name, self.balance)

	def check(self, other, money):
		if other.balance < money:
			raise ValueError('Not enough balance for check')
		if not other.checking_account:
			raise ValueError('Not a checking account')
		self.balance += money
		other.balance -= money
		return '{} has {} and {} has {}.'.format(self.name, self.balance, other.name, other.balance)

	def add_cash(self, money):
		self.balance += money
		return '{} has {}.'.format(self.name, self.balance)


class User(object):

	def __init__(self, name, balance, checking_account):
		self.name = name
		self.balance = balance
		self.checking_account = checking_account

	def withdraw(self, money):
		if self.balance < money:
			raise ValueError
		self.balance -= money
		return f'{self.name} has {self.balance}.'

	def check(self, user, money):
		user.withdraw(money)
		if not user.checking_account:
			raise ValueError
		self.balance += money
		return f'{self.name} has {self.balance} and {user.name} has {user.balance}.'

	def add_cash(self, money):
		self.balance += money
		return f'{self.name} has {self.balance}.'


class User(object):

	def __init__(self, name, balance, checking_account):
		self.name = name
		self.balance = balance
		self.checking_account = checking_account

	def withdraw(self, money):
		if money <= self.balance:
			self.balance -= money
			return f'{self.name} has {self.balance}.'
		else:
			raise ValueError

	def check(self, other, money):
		if money <= other.balance and other.checking_account == True:
			other.balance -= money
			self.balance += money
			return f'{self.name} has {self.balance} and {other.name} has {other.balance}.'
		else:
			raise ValueError

	def add_cash(self, money):
		self.balance += money
		return f'{self.name} has {self.balance}.'