Skip to content

Course home

Programming concepts

Programming concepts

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
Question 13

An automated cargo freighter is being loaded with supply modules. To ensure a stable launch, the freighter must be loaded with cargo up to a specific target payload weight (in tonnes, t). Several supply modules will be loaded one by one, each contributing a different weight towards this target.

Write a Python program that asks the operator for the target payload weight and works out when the target is reached or exceeded. Each supply module can have a different weight.

The program should:

  • Get the user to enter the initial target payload weight.
  • Get the user to enter the weight of a supply module being loaded.
  • Subtract the module weight from the remaining target weight:
    • If the weight remaining is more than 0, output how much more weight is still needed to reach the target, and repeat this process until the remaining target weight is 0 or less.
    • If the weight remaining is exactly 0, output the message Optimal load achieved.
    • If the weight remaining is less than 0, output the message Excess payload is followed by the difference (as a positive number) showing by how much the modules exceeded the target.

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

[8]
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