Skip to content
MathsGenie logo
Open app

Course home

  1. GCSE
  2. Computer Science AQA
  3. Question bank

Programming concepts

EasyMediumHard
1234567891011121314151617181920212223
Question 12

An environmental agency is writing a program to assess a woodland's overall health index based on surveys from four distinct sectors.

The health index is adjusted downward if invasive weed patches are detected during the surveys.

Write a Python program to calculate the final health index.

You should assume there are four integer variables called s1, s2, s3 and s4 which have already been assigned values representing the health scores for the four sectors.

The program should:

  • prompt the user to enter the number of invasive weed patches detected and store this value in an integer variable
  • calculate the aggregate health index for the four sectors
    • if exactly two invasive weed patches were detected, the aggregate health index is reduced by 35
    • if more than two invasive weed patches were detected, the aggregate health index is reduced by 75% (i.e. quartered)
    • the aggregate health index should not be allowed to fall below 5
  • output the final health index.

You should use indentation as appropriate, meaningful variable name(s), and correct Python syntax in your answer.

[7]

Programming concepts Questions

  1. GCSE
  2. /Computer Science
  3. /Programming concepts