Skip to content

Instantly share code, notes, and snippets.

@edwindotcom
Created June 5, 2020 16:41
Show Gist options
  • Save edwindotcom/16575396e940918ee666b77dca29d4fd to your computer and use it in GitHub Desktop.
Save edwindotcom/16575396e940918ee666b77dca29d4fd to your computer and use it in GitHub Desktop.
convert inches to foot-inches
import sys
import math
def inch_to_ft_inch(inches):
ft = math.floor(int(inches)/12)
ret_inch = int(inches) % 12
return ft, ret_inch
val = inch_to_ft_inch(sys.argv[1])
print("{}\' {}\"".format(int(val[0]), val[1]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment