Skip to content

Course home

Programming concepts

Programming concepts

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
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]
Markscheme

Programming concepts Questions

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

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.

Question bank