I'm sure you'll be familiar with the National Lottery - it's been running for nearly 20 years. A large machine picks six balls out of a set of balls numbered from 1 to 49. Making such a machine is beyond most of us, but we can simulate one with a computer program.


Here is a reminder of the commands you might need for this task.

Your Task

Your task is to simulate a lottery machine and pick six random numbers from 1 to 49. Your program should:

  1. pick six random numbers from 1 to 49 (inclusive)
  2. display the six numbers so that they are separate and easy to read

The minimum output is the six numbers, but you can add extra text to make your program easier to understand.


If you run your program a few times, you'll probably realise that it's not like a real lottery machine. A real lottery machine would never pick the same number twice, for example, because once you've drawn a ball, it's not there to be drawn again. The lottery results are also normally read out in numerical order.

See if you can get your program to: