Coventry University Logo
4061CEM - Programming and Algorithms 1
  • Conditional Statements
    2

Conditional Statements

Before you attempt this activity, it is best that you review lecture video one from week six. 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 write a function that will reverse a string, utilising a for loop. The aim of the function is to reverse a string, i.e. 'hello' to 'olleh'. The function should return the reversed string.

Task 2

Write a function that prints all the numbers from zero to ten, but skips numbers \(4\) and \(7\). The function should return a list of numbers, for example:

[0, 1, 2, 3, 5, 6, 8, 9, 10]