Take a look at his code....
What does it do?
Look at the program and see if you were right!
Using the skills we have looked at so far, see if you can complete the following challenges...
In the example code above, the mole only appears in 1 one 3 of the holes.
Adapt the program above so that the mole will appear randomly in 1 of 5 holes.
Adapt the program so that instead of waiting 1 second before appearing and 1 second before disappearing, it waits a random time between 0.2 seconds and 1.4 seconds.
Adapt the program so that instead of repeating 10 times, it repeats until you have whacked 10 moles (i.e. the score is 10).
Create a program that:
Picks 2 random numbers between 1 and 100 and stores them in variables
Adds the 2 numbers together and stores the result in another variable.
Asks the player what the sum of the two numbers are and stores their answer.
Compares the user answer with the actual result:
If they match tell them they got it right
otherwise tell them they got it wrong and the correct answer
Adapt the program so that it will ask them 10 different questions.
Every time they get a question right, they should get a point.
At the end of the program, give them a score out of 10.
Don’t forget to initialise the score at the beginning of the program.