#!/usr/bin/python import sys from cjh.shell import Cli # Calculate how much of 2 different solutions you need to # combine to reach a target %ABV and volume. # Use: MixTool.py $%ABV1 $%ABV2 $TARGET_%ABV $TARGET_VOLUME # If no arguments are given, input is from stdin. # Pretty much a direct translation of MixTool.pl if len(sys.argv[1:])==0 : abv1 = Cli.input("%ABV of first ingredient: ") else : abv1 = sys.argv[1] abv1 = float(abv1) if len(sys.argv[1:]) < 2 : abv2 = Cli.input("%ABV of second ingredient: ") else : abv2 = sys.argv[2] abv2 = float(abv2) print('') if len(sys.argv[1:]) < 3 :