Level 01: inputs, outputs and structure 0 of 9 activities solved
  1. 1. Hello World Not yet solved
  2. 2. Carpet cost Not yet solved
  3. 3. Ball pit Not yet solved
  4. 4. Dice face 5 Not yet solved
  5. 5. Temperature converter Not yet solved
  6. 6. Fish tank volume Not yet solved
  7. 7. Microscopy Not yet solved
  8. 8. Circle properties Not yet solved
  9. 9. Energy bill calculator Not yet solved
Next series Level 02: selections
Level 01: inputs, outputs and structure

2. Carpet cost

Sign in to hand in your solution and get feedback.

# Carpet cost program # ------------------------- # Subprograms # ------------------------- def carpet_cost(width, length, price): carpet = width * length * price grippers = width + length fitting = 50 return carpet + grippers + fitting # ------------------------- # Main program # ------------------------- width = int(input("Enter the width of the room to nearest meter: ")) length = int(input("Enter the length of the room to nearest meter: ")) price = float(input("Enter the price of the carpet per m2: ")) print("The total cost is: £", carpet_cost(width, length, price))