6  Working with Lists

6.1 Task : Creating Lists

6.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 lists with the following within:
    • A function named mylistst.
      • This function will receive as an input a string and return each character in a list.
    • A function named mylistnum.
      • This function will receive as an input a number and return a list of numbers from 0 to that number.

6.2 Task : Changing List Items

6.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 lists with the following within:
    • A function named myfirstnames
      • This function will receive as a parameter a list of lowercase names (ex: [“joão”,“pedro”,“luís”,“ana”,“susana”,“teresa”]) as an input and should return a list with the names where the first character is in uppercase (ex: [“João”,“Pedro”,“Luís”,“Ana”,“Susana”,“Teresa”]).

6.3 Task : Add and Remove List Items

6.3.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 lists with the following within:
    • A function named myaddremove
      • This function will receive as a parameter a list of strings, and 2 other parameters, as individual strings.
      • The first string will be added to the list.
      • the second string will be removed from the list.
      • The changed list is returned.