10  Working with Decision Structures

10.1 Task : Creating a selective List

10.1.1 Package “istec-p4”

  • Use the package you created in the previous session.
  • Use the package locally (you don’t need to publish it to everyone)
  • Within this package, create a module named decisions with the following within:
    • A function named mydecision.
      • This function will receive as parameters 2 lists: one with comercial car brands and another with those brands present in Formula 1 races.
        • Ex: commercial = [“Bmw”,“Audi”,“Volvo”,“Mercedes”,“Ferrari”] , fone = [“Bmw”,“McLaren”,“Mercedes”,“Ferrari”,“Williams”]
      • The function should return 2 Lists with the brand names in only the odd/(impares) positions.

10.2 Task : Managing a selective List

10.2.1 Package “istec-p4”

  • Use the package you created in the previous session.
  • Use the package locally (you don’t need to publish it to everyone)
  • Within this package, create a module named decisions with the following within:
    • A function named mydecision2.
      • This function will receive as parameters 2 lists as obtained in the previous task.
      • The function should return a List with elements from the 2 lists, where, from the first list you should pick only even/(pares) positions and from the second list, only prime/(primos) positions.