TheAceHome

Untitled

Jun 10th, 2020
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. import numpy as np
  2. class Steel():
  3. def __init__(self,a):
  4. self.steeltype = a[0]
  5. self.thickness = a[1]
  6. self.density = a[2]
  7. self.a = a[3]
  8. if len(a)==5:
  9. self.b = a[4]
  10.  
  11. def S(self):
  12. if self.steeltype==1:
  13. s=self.a*self.a
  14. if self.steeltype==2:
  15. s=self.a*self.b
  16. if self.steeltype==3:
  17. s=(self.a*self.b)/2
  18. return s
  19.  
  20. def weight(self):
  21. weigh=(Steel.S(self)*0.001)*self.thickness*self.density
  22. return weigh
  23.  
  24. def INFO(self):
  25. print(self.steeltype,self.thickness,self.density,Steel.S(self),Steel.weight(self))
  26.  
  27.  
  28. omega=[[1,2,7800,4],
  29. [2,3,7670,4,3],
  30. [3,2,7745,6,5],
  31. [1,5,8000,6],
  32. [3,2,7640,5,8],
  33. [1,1,8170,3],
  34. [2,6,7900,2,3],
  35. [1,3,8100,3],
  36. [1,4,7800,4],
  37. [3,5,7640,3,4],
  38. [2,2,7730,4,3],
  39. [2,3,7850,6,4],
  40. [2,2,7743,5,2],
  41. [2,1,7900,3,1],
  42. [2,3,8100,4,2]]
  43. d=Steel(omega[0])
  44. print(d.S())
  45. print(d.weight())
  46. d.INFO()
  47. sums,weight=0,0
  48. for i in range(len(omega)):
  49. d=Steel(omega[i])
  50. d.INFO()
  51. sums+=d.S()
  52. weight+=d.weight()
  53. print(sums,weight)
Advertisement
Add Comment
Please, Sign In to add comment