TheAceHome

Untitled

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