Constructs

EasyMediumHard
123456789101112131415161718192021222324252627282930
Question 21
Medium

A program processes luggage weights to determine their shipping categories.

The program must continually prompt the user to input a package weight (an integer) and output the corresponding classification until the user inputs 0 to stop the program.

The lines of code required for this program are currently mixed up and have had their indentation removed.

Mapping Table

Input weight (kg)Output
0Exits program
1 to 10"Light"
11 to 23"Standard"
24 or more"Heavy"

Scrambled Lines of Code

  • weight = int(input("Enter weight: "))
  • while weight != 0:
  • print("Standard")
  • if weight <= 10:
  • print("Heavy")
  • elif weight <= 23:
  • print("Light")
  • weight = int(input("Enter weight: "))
  • else:

Rearrange these exact lines of code and apply correct indentation, white space, and logical order so that the program runs correctly and produces the required outputs.

Do not change the text or commands inside the provided lines of code. Do not add any additional statements.

[15]

Constructs Questions

  1. GCSE
  2. /Computer Science
  3. /Constructs