# An exercise 

class Senator():
  def __init__(self, name):
    self.name = name
    self.bills_voted_on = [] ## list of Bill objects

  def vote(self, bill, choice):
    if choice not in ['yes', 'no', 'abstain']:  return print('Not a valid option.')
    bill.votes[choice].append(self.name)
    self.bills_voted_on.append(bill)
    return 'Senator ' + self.name + ' vote ' + choice + ' on ' + bill.title + ' bill.'

  def __str__(self): # print method
    return 'Senator {}'.format(self.name)


class Bill():
  def __init__(self, title):
    self.title = title
    self.votes = {"yes" : [], "no" : [], "abstain" : []}
    self.passed = None

  def __str__(self): # Print method
    return self.title + " Bill"

  def result(self):
    if len(self.votes['yes']) > len(self.votes['no']):
      self.passed = True
    else:
      self.passed = False
    return self.passed

## should be able to do these things
jane = Senator("Jane")
print(jane)
jack = Senator("Jack")
print(jack)
environment = Bill("Environmental Protection")
print(environment)
jane.vote(environment, "yes")
jack.vote(environment, "no")
environment.votes['yes']
environment.votes['no']
environment.result()
print(jack.bills_voted_on[0].passed)

6ce2a62c918d87f35bdf9eaa0baa355fef2ad9a6
class Senator:
    <mask token>

    def vote(self, bill, choice):
        if choice not in ['yes', 'no', 'abstain']:
            return print('Not a valid option.')
        bill.votes[choice].append(self.name)
        self.bills_voted_on.append(bill)
        return ('Senator ' + self.name + ' vote ' + choice + ' on ' + bill.
            title + ' bill.')
    <mask token>


class Bill:

    def __init__(self, title):
        self.title = title
        self.votes = {'yes': [], 'no': [], 'abstain': []}
        self.passed = None

    def __str__(self):
        return self.title + ' Bill'

    def result(self):
        if len(self.votes['yes']) > len(self.votes['no']):
            self.passed = True
        else:
            self.passed = False
        return self.passed


<mask token>

class Senator:

    def __init__(self, name):
        self.name = name
        self.bills_voted_on = []

    def vote(self, bill, choice):
        if choice not in ['yes', 'no', 'abstain']:
            return print('Not a valid option.')
        bill.votes[choice].append(self.name)
        self.bills_voted_on.append(bill)
        return ('Senator ' + self.name + ' vote ' + choice + ' on ' + bill.
            title + ' bill.')
    <mask token>


class Bill:

    def __init__(self, title):
        self.title = title
        self.votes = {'yes': [], 'no': [], 'abstain': []}
        self.passed = None

    def __str__(self):
        return self.title + ' Bill'

    def result(self):
        if len(self.votes['yes']) > len(self.votes['no']):
            self.passed = True
        else:
            self.passed = False
        return self.passed


<mask token>

class Senator:

    def __init__(self, name):
        self.name = name
        self.bills_voted_on = []

    def vote(self, bill, choice):
        if choice not in ['yes', 'no', 'abstain']:
            return print('Not a valid option.')
        bill.votes[choice].append(self.name)
        self.bills_voted_on.append(bill)
        return ('Senator ' + self.name + ' vote ' + choice + ' on ' + bill.
            title + ' bill.')

    def __str__(self):
        return 'Senator {}'.format(self.name)


class Bill:

    def __init__(self, title):
        self.title = title
        self.votes = {'yes': [], 'no': [], 'abstain': []}
        self.passed = None

    def __str__(self):
        return self.title + ' Bill'

    def result(self):
        if len(self.votes['yes']) > len(self.votes['no']):
            self.passed = True
        else:
            self.passed = False
        return self.passed


<mask token>
print(jane)
<mask token>
print(jack)
<mask token>
print(environment)
jane.vote(environment, 'yes')
jack.vote(environment, 'no')
environment.votes['yes']
environment.votes['no']
environment.result()
print(jack.bills_voted_on[0].passed)

class Senator:

    def __init__(self, name):
        self.name = name
        self.bills_voted_on = []

    def vote(self, bill, choice):
        if choice not in ['yes', 'no', 'abstain']:
            return print('Not a valid option.')
        bill.votes[choice].append(self.name)
        self.bills_voted_on.append(bill)
        return ('Senator ' + self.name + ' vote ' + choice + ' on ' + bill.
            title + ' bill.')

    def __str__(self):
        return 'Senator {}'.format(self.name)


class Bill:

    def __init__(self, title):
        self.title = title
        self.votes = {'yes': [], 'no': [], 'abstain': []}
        self.passed = None

    def __str__(self):
        return self.title + ' Bill'

    def result(self):
        if len(self.votes['yes']) > len(self.votes['no']):
            self.passed = True
        else:
            self.passed = False
        return self.passed


jane = Senator('Jane')
print(jane)
jack = Senator('Jack')
print(jack)
environment = Bill('Environmental Protection')
print(environment)
jane.vote(environment, 'yes')
jack.vote(environment, 'no')
environment.votes['yes']
environment.votes['no']
environment.result()
print(jack.bills_voted_on[0].passed)

# An exercise 

class Senator():
  def __init__(self, name):
    self.name = name
    self.bills_voted_on = [] ## list of Bill objects

  def vote(self, bill, choice):
    if choice not in ['yes', 'no', 'abstain']:  return print('Not a valid option.')
    bill.votes[choice].append(self.name)
    self.bills_voted_on.append(bill)
    return 'Senator ' + self.name + ' vote ' + choice + ' on ' + bill.title + ' bill.'

  def __str__(self): # print method
    return 'Senator {}'.format(self.name)


class Bill():
  def __init__(self, title):
    self.title = title
    self.votes = {"yes" : [], "no" : [], "abstain" : []}
    self.passed = None

  def __str__(self): # Print method
    return self.title + " Bill"

  def result(self):
    if len(self.votes['yes']) > len(self.votes['no']):
      self.passed = True
    else:
      self.passed = False
    return self.passed

## should be able to do these things
jane = Senator("Jane")
print(jane)
jack = Senator("Jack")
print(jack)
environment = Bill("Environmental Protection")
print(environment)
jane.vote(environment, "yes")
jack.vote(environment, "no")
environment.votes['yes']
environment.votes['no']
environment.result()
print(jack.bills_voted_on[0].passed)
