An astronaut is controlling a deep-space mining drone to harvest helium-3 fuel cells from an asteroid field.
The aim of the mission is to harvest as close to a target of 80 units of fuel as possible, without going over 80. If the total harvest goes over 80, the fuel tank overloads and the player loses.
The drone's harvested fuel starts at 0.
For each mining turn:
At the end of the session, the program should run as follows:
Write a Python program to simulate this deep-space harvesting game.
The first line of the program must import the random library:
import random
The drill harvests must be generated using random.randint(a, b) which returns a random integer in the range a to b inclusive.
You should use meaningful variable names and correct Python syntax in your answer.
Drill 1: 18
Drill 2: 25
Current harvest: 43
Mine again? yes
Drill 1: 12
Drill 2: 15
Current harvest: 70
Mine again? yes
Drill 1: 8
Drill 2: 9
Current harvest: 87
Overloaded! You lose.
298 exam-style questions on AQA GCSE Computer Science Programming concepts. Each one has a worked solution and a mark scheme showing where the marks go.