Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- class Steel():
- def __init__(self,a):
- self.steeltype = a[0]
- self.thickness = a[1]
- self.density = a[2]
- self.a = a[3]
- if len(a)==5:
- self.b = a[4]
- def S(self):
- if self.steeltype==1:
- s=self.a*self.a
- if self.steeltype==2:
- s=self.a*self.b
- if self.steeltype==3:
- s=(self.a*self.b)/2
- return s
- def weight(self):
- weigh=(Steel.S(self)*0.001)*self.thickness*self.density
- return weigh
- def INFO(self):
- print(self.steeltype,self.thickness,self.density,Steel.S(self),Steel.weight(self))
- omega=[[1,2,7800,4],
- [2,3,7670,4,3],
- [3,2,7745,6,5],
- [1,5,8000,6],
- [3,2,7640,5,8],
- [1,1,8170,3],
- [2,6,7900,2,3],
- [1,3,8100,3],
- [1,4,7800,4],
- [3,5,7640,3,4],
- [2,2,7730,4,3],
- [2,3,7850,6,4],
- [2,2,7743,5,2],
- [2,1,7900,3,1],
- [2,3,8100,4,2]]
- d=Steel(omega[0])
- print(d.S())
- print(d.weight())
- d.INFO()
- sums,weight=0,0
- for i in range(len(omega)):
- d=Steel(omega[i])
- d.INFO()
- sums+=d.S()
- weight+=d.weight()
- print(sums,weight)
Advertisement
Add Comment
Please, Sign In to add comment