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("\nYour 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.
Practise Edexcel GCSE Computer Science Develop code with exam-style questions for GCSE Computer Science. 57 questions 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, matched to the Edexcel GCSE Computer Science (1CP2) specification and written in Paper 1 and Paper 2 style. Every question includes a full worked solution and mark scheme, so you can see where marks are awarded rather than just whether you got the answer right.