Source code for Exercises.essentials.lists.managing_acme.managing_acme

"""
1.  The employees of this company have the following email addresses (by order of arrival date in the company)::

        Wile.E.Coyote@acme.com 
        Looney.Tunes@acme.com 
        Chuck.Jones@acme.com 
        Road.Runner@acme.com 
        Michael.Maltese@acme.com
        Speedy.Gonzales@acme.com
        Calamity.Coyote@acme.com
        Bugs.Bunny@texavery.com


    Copy these 8 emails into a `list` called `employee_emails`. Also create a `list` of employee IDs from 0 to 7 without writing each ID manually (let's assume that we will reuse your code once ACME's products finally start to work and sell and the company becomes huge). 


2.   A new employee, number 8, is joining the company: "Acceleratti incredibilis". Add his email address to the list. Update the employee_ids list.

3.  Suprisingly, one of ACME's products (the "Earthquake Pills") works remarkably well and was developed surprisingly fast. Pull up the emails for the team responsible for them, that is employees with IDs 2, 3, 4 and 5. This can be done using **list slicing**.

4. Despite the Earthquake Pills, this year, the poor financial results of the company only allow the company to shell out bonuses to every other employee (starting with employee 0). Using slicing, pull up their email addresses to announce the good news to them.

5.  In fact the following year, the company is doing even worse. Mad not to have had a bonus the year before, the Looney Tunes decides to spin off half the company to create a new one with employees with odd IDs, except that Bugs Bunny guy (employee 7), because he doesn't really belong here... Pull up their emails to send them a secret message.

    .. hint::

       Again slicing could help here since we can extract every other element with it. Could we change the start point to grab the other set of every other employee?

6.  His communication was intercepted: Looney Tunes is fired. Remove him from the list of employees. Remove his employee ID as well. 

7.  Capture the list of locations of the company in a list (ordered by importance): "Taos", "Phoenix", "Santa Fe", and "Flagstaff". Considering the management issues in ACME, it is decided to reverse the order of these locations, and move the headquarters to Flagstaff. Update the list of locations.

8.  The Boss ends up missing the nice skiing in Taos, and decides to reverse the location order again. The challenge here is to reverse the order without using the reverse method.

   .. hint::
      Slicing could help...
"""

[docs]def question_one (): """ Return the email list shown above and a employee ID list. """ employee_email_list = [ ] # Replace [ ] with your code id_list = [ ] return employee_list, id_list
[docs]def question_two (employee_name): """ Add `employee_name` (a string) and the appropriate id number to the existing employee_list and id_list. """ pass
[docs]def question_three (employee_name): """ Get the email addresses for employees 2,3,4, and 5 """ pass
[docs]def question_four (): """ Use slicing to get the email addresses of every other employee """ pass
[docs]def question_five (): """ Use slicing to get the email addresses of employees with odd id numbers. """ pass
[docs]def question_six (): """ Remove "Looney Tunes" from the list of employees alongwith his ID number. """ pass
[docs]def question_seven (): """ Build a list containing "Taos", "Phoenix", "Santa Fe", and "Flagstaff", in that order. Return the reverse of that list. Hint: Check list methods """ pass
[docs]def question_eight (): """ Reverse the location list without using the reverse method. """ pass
if __name__ == '__main__': employee_email_list, id_list = question_one () print(employee_email_list) print(id_list) question_two() smart_employees = question_three() print(smart_employees) even_numbered_employee = question_four() print(even_numbered_employees) odd_numbered_employee = question_five() print(odd_numbered_employees) question_six() locations = question_seven() print(locations) reversed_locations = question_eight() print(reversed_locations) #Copyright 2008-2016, Enthought, Inc. #Use only permitted under license. Copying, sharing, redistributing or other unauthorized use strictly prohibited. #http://www.enthought.com