Last active
March 22, 2019 02:30
-
-
Save tschoppi/f2f2e372f080478d3da4 to your computer and use it in GitHub Desktop.
Calculate the length of a 16-gauge wire according to the weight in pounds.
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
"""Calculate the length of a 16-gauge wire according to the weight in pounds.""" | |
# Natural constants | |
PI = 3.14159 | |
# Conversion factors | |
cmpin = 2.54 # cm / in | |
gplb = 453.6 # g / lb | |
# Constants | |
diam = 0.05082 * cmpin # cm | |
dens = 8.92 # g / cm^3 | |
def wirelength(poundage): | |
"""Return length of wire in meters""" | |
mass = poundage * gplb # g | |
volume = mass / dens # cm^3 | |
length = volume / (PI * diam**2) # cm | |
return length * 0.01 # m | |
print("Wire length of 1.00 lb of 16-gauge wire: {} m".format(round(wirelength(1.00), 2))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment