Ask Question
20 April, 03:58

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.

+3
Answers (1)
  1. 20 April, 04:49
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers