Skip to content

Instantly share code, notes, and snippets.

@chand1012
Created July 19, 2021 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chand1012/6688e897181fb53931bc664052db730c to your computer and use it in GitHub Desktop.
Save chand1012/6688e897181fb53931bc664052db730c to your computer and use it in GitHub Desktop.
n = None
total_volume = None
n = int(input('Enter number of ingredients: '))
total_volume = float(input('Enter total drink volume: '))
ingredients = []
for i in range(n):
nth = i + 1
print(f'-------- Ingredient {nth} --------')
abv = float(input('Enter alcohol by volume (ABV): '))
if abv > 1:
abv = abv / 100
iv = float(input('Enter volume of ingredient: '))
ingredients += [abv * iv]
s = sum(ingredients)
total_abv = s / total_volume * 100
proof = round(total_abv * 2)
print(f'Final calculation: ')
print(f'{total_abv} %')
print(f'{proof} proof')
input('Press enter to continue.....')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment