Company vote 2 ============== Save all functions into the same file named ``company.py``. The file :download:`votes.txt` contains the result of the vote held in a company. In each line there is the name of a shareholder, the number of shares she has, a Boolean that contains True if she is a partner founder of the company, and another boolean that contains True if she approves the reform proposed. The file contains the following lines: .. literalinclude:: examples/votes.txt :language: python The first two lines correspond to the partner founder Dani, who has 100 shares and to the partner (not-founder) Manel, with 5 shares. Both have approved the reform. #. Write the function :py:func:`person` that takes a string with a line like that previously described and returns a tuple with a string representing the name, an integer representing the number of shares and two Booleans representing if she is a partner founder and if she approves the reform. Examples: .. literalinclude:: person.txt :language: python3 :lines: 3- .. note:: More tests are provided in file :download:`person.txt` #. Write the function :py:func:`read` that takes the name of a file with the same format as the file described in the beginning, and returns a list with tuples like those described in the previous paragraph, one for each person of the file. This function has to use the previous one. Example: .. literalinclude:: read.txt :language: python3 :lines: 3- .. note:: More tests are provided in file :download:`read.txt` - The partner founders have the right to veto. That is, if a partner founder votes against the reform, it is rejected. Write the function :py:func:`veto` that takes a list of tuples like those described in the previous paragraph and returns True if any partner founder has voted against and False otherwise. Examples: .. literalinclude:: veto.txt :language: python3 :lines: 3- .. note:: More tests are provided in file :download:`veto.txt` - The vote of each shareholder is weighted with the number of shares she has. Thus, the vote of a shareholder has a value of 200 if she has 200 shares. Write the function :py:func:`percentage` that takes a list of tuples like those previously described, and returns the percentage of votes that have accepted the proposal. Examples: .. literalinclude:: percentage.txt :language: python3 :lines: 3- .. note:: More tests are provided in file :download:`percentage.txt` #. Write the function :py:func:`company` that takes the name of a file with the same format as the file described in the beginning, and returns one of these two strings: *The reform has been approved* or *The reform has not been approved*. The reform will be approved if nobody with a right to veto has voted against it AND if more than half of the (weighted) votes are favourable. This function has to use the three previous functions. In the given example, the reform would have been approved since no partner founder has issued a veto and there are 155 votes in favour and 150 against. .. note:: More tests are provided in file :download:`company.txt` .. rubric:: Solution A solution of these functions is provided in the :download:`company.py` file.