Ask Question
24 May, 12:34

Label the strength of a beer based on its ABV. For each beer display the beer's name, ABV, and a textual label describing the strength of the beer. The label should be "Very High" for an ABV more than 10, "High" for an ABV of 6 to 10, "Average" for an ABV of 3 to 6, and "Low" for an ABV less than 3. Show the records by beer name.

+4
Answers (1)
  1. 24 May, 15:22
    0
    By presuming the question expect us to write a program to address the problem and the solution code written in Python is as follow:

    beer_name = input ("Enter beer name: ") abv = int (input ("Enter ABV value: ")) if (abv > 10) : label = "Very High" elif (abv >=6) : label = "High" elif (abv >=3) : label = "Average" else: label = "Low" print ("Beer Name: " + beer_name) print ("ABV value: " + str (abv)) print (label)

    Explanation:

    Firstly, we can use input function to prompt user to input beer name and ABV value (Line 1 - 2).

    Next, create if else if statements to check abv fallen into which range of value and then set a label accordingly (Line 4 - 11). For example if abv is 4, the label will be set to "Average".

    At last, print the information of beer that includes beer name, abv value and label (Line 13 - 15).
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Label the strength of a beer based on its ABV. For each beer display the beer's name, ABV, and a textual label describing the strength of ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers