Created
April 22, 2020 14:59
-
-
Save SweiLz/288cceef32ca06eac936eae7dbfd3b69 to your computer and use it in GitHub Desktop.
ฟังก์ชั่นคำนวณค่าไฟออกมาเป็นหน่วยบาท
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calUnit(unit,Ft = -11.6): | |
total = 0 | |
temp_unit = unit | |
if unit <= 150: | |
print("Case: ","1.1") | |
else: | |
print("Case: ","1.2") | |
if temp_unit > 400: | |
total += ((temp_unit-400) * 4.4217) | |
temp_unit = 400 | |
# total += (250 * 4.2218) | |
# total += (150 * 3.2484) | |
if temp_unit > 150: | |
total += (temp_unit-150 * 4.2218) | |
total += (150 * 3.2484) | |
temp_unit = 150 | |
elif temp_unit > 150: | |
pass | |
return total | |
if __name__ == "__main__": | |
# print(calUnit(1231,-11.6)) | |
print(calUnit(400,-11.6)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment