A student program designed to process exam grades is shown below. This program needs to be modified so that it repeats exactly five times using definite (count-controlled) iteration.
score = int(input("Enter score: "))
if score >= 50:
print("Pass")
else:
print("Fail")
Select the option that does this correctly.
for i in range(0, 5):
score = int(input("Enter score: "))
if score >= 50:
print("Pass")
else:
print("Fail")
count = 1
while count <= 5:
score = int(input("Enter score: "))
if score >= 50:
print("Pass")
else:
print("Fail")
count = count + 1
for i in range(0, 4):
score = int(input("Enter score: "))
if score >= 50:
print("Pass")
else:
print("Fail")
count = 5
while count > 0:
score = int(input("Enter score: "))
if score >= 50:
print("Pass")
else:
print("Fail")
count = count - 1
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.