Level 01: inputs, outputs and structure 0 van 9 activiteiten opgelost
  1. 1. Hello World Nog niet opgelost
  2. 2. Carpet cost Nog niet opgelost
  3. 3. Ball pit Nog niet opgelost
  4. 4. Dice face 5 Nog niet opgelost
  5. 5. Temperature converter Nog niet opgelost
  6. 6. Fish tank volume Nog niet opgelost
  7. 7. Microscopy Nog niet opgelost
  8. 8. Circle properties Nog niet opgelost
  9. 9. Energy bill calculator Nog niet opgelost
Volgende reeks Level 02: selections
Level 01: inputs, outputs and structure

2. Carpet cost

Meld je aan om je oplossing in te dienen en feedback te krijgen.

# 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))