0
所以這是基本的砌牆計算器代碼,我有:如何將更多功能添加到石膏板工程中?
def drywall_sheets_required(width,depth,height,useScrap=False):
if useScrap==False:
sheetSize1=(4*8)
surfacearea1=(width*depth)
surfacearea2=(width*height)
surfacearea3=(height*depth)
TotalArea=surfacearea1+surfacearea2+surfacearea2+surfacearea3+surfacearea3
ss1=surfacearea1/sheetSize1
TSS1=ss1
ss3=surfacearea2/sheetSize1
TSS2=ss3+ss3
ss5=surfacearea3/sheetSize1
TSS3=ss5+ss5
Dsum=TSS1+TSS2+TSS3
print(TotalArea)
print("You need",int(Dsum)+1,"drywall sheets for the room")
基本上它計算的四面牆壁和天花板的面積和砌牆的面積是32.但是我以擴大該腳本將其劃分像這樣:
def drywall_sheets_required(width,depth,height,sheetSize=(4,8),useScrap=True):
如果useScrap爲true,那麼任何剩餘的幹砌牆都可以重新使用。當useScrap爲false時,所有廢料都必須扔掉。對於我現在的代碼,如果總面積不是一個整數,它會添加一個。所以我想這意味着useScrap是錯誤的。
另外,有沒有一種方法可以改變石膏板的方向?標準尺寸是(4,8),但如果我將其更改爲(8,4),它會產生顯着差異嗎?