Created
July 19, 2021 00:05
-
-
Save chand1012/6688e897181fb53931bc664052db730c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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