A program is written for a chemical solvent selection system in a laboratory. It displays the names of available solvents, stored in an array. The user enters the number of tests they want to run. That number of solvents is selected randomly from the array and displayed.
impor random
solventList = ["Ethanol", Acetone, "Water",
"Hexane", "Toluene"]
print("Available solvents:")
for solvent in solventList
print("- " + solvent)
numTests = int(input("How many solvent tests to run? "))
print("
Your random test sequence:")
for count in range(numTests - 1):
index = random.
selected = solventList[index + 1]
print(selectd)
Amend the code to:
impor random)for solvent in solventList)index = random.)solventList = ...)selected = solventList[index + 1])print(selectd))for count in range(numTests - 1):)Do not change the basic functionality of the correct parts of the code. Do not add any additional features.
51 exam-style questions on Edexcel GCSE Computer Science Develop code, covering Decomposition and abstraction to solve problems, Read, write, analyse and refine programs, Converting algorithms into programs, Techniques for readable, maintainable code, Identifying and correcting program errors, and Evaluating program fitness and efficiency. Each one has a worked solution and a mark scheme showing where the marks go.