A laboratory technician is writing a Python program to compare the acidity of two soil samples. The program prompts the technician to input the pH value of each sample (as a real number) and then outputs which sample is more acidic (the sample with the lower pH value).
Complete the program below by filling in the gaps [1] to [5] using the items in Figure 1.
You will not need to use all the items in Figure 1. Each item in Figure 1 should only be used once.
ph1 = float(input("Enter pH of Sample 1: "))
ph2 = _____[1]_____(input("Enter pH of Sample 2: "))
if ph1 < ph2:
print(_____[2]_____, "is more acidic.")
_____[3]_____ ph1 > ph2:
print(_____[4]_____, "is more acidic.")
_____[5]_____:
print("The acidities are equal.")
| float | ph1 | ph2 | else |
| elif | int | ph3 | if |
| then | input | < | |
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.