Answer:
import random
randomlist = []
for i in range(0,20):
n = random.randint(-29,30)
if n < 0 :
n = 100
randomlist.append(n)
print(randomlist)
Explanation:
The random module is first imported as it takes care of random. Number generation.
An empty list called randomliay is created to hold the generated random integers.
Using a for loop, we specify the range of random numbers we want.
Inside the for loop ; we attach our generated random integer which will be in the range (-29 to 30) in a variable n
For each n value generated, if the value is less than 0( it is negative, since all the values are integers), replace the value with 100.
Answer:
true
Explanation:
I think that's what it has been in my time of classes
Answer:
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).