User Tools

Site Tools


en:web_development:lists:exercise

This is an old revision of the document!


Web Development Lesson 3 - Lists

Exercises

Try the following exercises to practice what you've learnt about lists.

Ordered List

Create the following list using HTML and CSS. Feel free to change the items to your own favourites. Add links to some of the items using anything appropriate.

1. Favourite Countries
  a. Colombia
  b. Australia
  c. Japan
  d. Bhutan
2. Favourite Music
  a. Shakira
  b. Powderfinger
  c. The Corrs

Even Numbers

Write a Javascript program that displays the even numbers between 1 and 20.

Factorial

Write a Javascript program that calculates the factorial of a number provided by the user. The factorial of 4 is 1x2x3x4. In Javascript, the multiplication symbol is written as </html>*</html> (ie product = 2*4).

Guessing Game

Are you ready for a coding challenge? Write a game that

  • defines a number between 1 and 10
  • prompts the user for a number between 1 and 10
  • checks the value and returns whether the number was correct or not (HINT: use an 'if' statement)
  • runs 3 times before stopping (HINT: use a 'for loop')

Next: Summary

en/web_development/lists/exercise.1639401036.txt.gz · Last modified: 2023/08/16 09:33 (external edit)