Last active
February 12, 2024 18:21
-
-
Save compscitwilight/7e84b2b6f050e1526ef1d5ffdf031457 to your computer and use it in GitHub Desktop.
Python script to calculate the total wattage of a power supply in a given amount of time, and also calculate for the price/KWh in a given time period.
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
psu_watts = int(input("Power supply wattage (w): ")) | |
price_per_wh = float(input("Price per kilowatt hour (cents): ")) | |
days = int(input("Days: ")) | |
total_wattage = psu_watts * (days * 24) | |
total_price = ((total_wattage / 1000) * price_per_wh) / 100 | |
print() | |
print("Total wattage: " + str(total_wattage)) | |
print("Total price for " + str(price_per_wh) + "c/KWh: $" + str(total_price)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment