Advertisement
Guest User

Untitled

a guest
Jul 28th, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. Traceback (most recent call last):
  2.  
  3. File "/Users/shaunrogers/Desktop/Plymstock Prep/GCSE CS/SOL/Controlled Assessment/Sample Papers Solutions/gardening Task 2.py", line 105, in <module>
  4.  
  5. lawn = m2_items("lawn",0)
  6. File "/Users/shaunrogers/Desktop/Plymstock Prep/GCSE CS/SOL/Controlled Assessment/Sample Papers Solutions/gardening Task 2.py", line 23, in m2_items
  7.  
  8. minutes = area*time[index]
  9.  
  10. TypeError: 'float' object is not subscriptable
  11.  
  12. def m2_items (item,index):
  13.  
  14. global costs, time, LABOUR
  15.  
  16. length = int(input("How long is the "+ item+"?n"))
  17.  
  18. width = int(input("How wide is the "+item+"?n"))
  19.  
  20. area = length*width
  21.  
  22. cost_m2 = float(costs[index])
  23.  
  24. total_cost = area*cost_m2
  25.  
  26. minutes = area*time[index]
  27.  
  28. hours = int(minutes/60)
  29.  
  30. labour = LABOUR*hours
  31.  
  32. labour_cost=round(labour,2)
  33.  
  34. m2_details = [area, cost_m2, total_cost,hours, labour_cost]
  35.  
  36. return m2_details
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement