Coventry University Logo
4061CEM - Programming and Algorithms 1
  • Sequence Data Types
    3

Sequence Data Types

Before you attempt this activity, it is best that you review lecture video two from week three. You can find the video and slides on the module page.

For this activity you will be using the integrated development environment recommended by the module leader. If you need to set up your development environment, it is recommended that you check out the instructions from activity four of week one.

Are You Struggling?

If you have trouble with any of the tasks or want to check your answers are correct, then please make yourself known to a member of staff.

Task 1

For this task you need to create a list with the name module. The list should be populated with the following details about this module: i.e. the module code, title and leader.

Once this list has been created, you will then need to add to the end of the list the following staff member: Dr Daniel Goldsmith; using an appropriate function. Upon the creation of the list, you will need to provide a solution for the following:

  1. Access the two members of staff using a negative range accessor
  2. Remove Dr Ian Cornelius from the list using an appropriate function
  3. Remove Dr Daniel Goldsmith using an index number

Task 2

Finally, you need to create a second list consisting of just the staff members: Dr Ian Cornelius and Dr Daniel Goldsmith. You are then required to merge the previous list and the newly created staff list using an appropriate function. It is important that the result of the merging should create a new third list.

Task 3

For this task you need to create a tuple with the name colours. The tuple should be populated with the following values: red, orange, green, blue, indigo and violet.

Once the tuple has been created, you need to access a range of elements from the second and up to and including the sixth element. To do this, you should consider using an appropriate function and these values should be stored in a new variable called selectedColours.