Answer:
Answered below
Explanation:
//Program is written in Java programming //language
Class Box{
private double length;
private double width;
private double height;
Box(double len, double wid, double hgt){
length = len;
width = wid;
height = hgt;
}
public double volumeOfBox( ){
double volume = length * width * height;
return volume;
}
public double getLength( ){
return length;
}
public double getWidth( ){
return width;
}
public double getHeight( ){
return height;
}
}
Answer:
userInput = input("Please enter a string of words ")
userInput.split ()
for item in userInput.split ():
if item =="darn":
print("Censored")
break
else:
print(userInput)
Explanation:
Using Python programming language, the input function is used to receive the users input and save in a variable userInput
Then the .split method is used to convert the words into a list of words.
Using a for loop, the code checks for the word darn and prints censored if it exists else it prints the userInput
Answer:
The owls population increased by 13 in one year
Explanation:
The given data on the owl population are as follows;
The number of new owls born = 20 (positive increase in population)
The number of owls that die = 10 (negative decrease in population)
The number of owls that enter the forest = 5 (positive increase in population)
The number of owls that left the forest = 2 (negative decrease in population)
Let 'w' represent the number of new owls born, let 'x' represent the number of owls that die, let 'y' represent the number of owls that enter the forest and let 'z' represent the number of owls that left the forest, we get;
The change in population, ΔP = w - x + y - z
By plugging in the values, we get;
ΔP = 20 - 10 + 5 - 2 = 13
The change in the population of owls in one year is an increase in 13 owls.
Answer:
Check the explanation
Explanation:
def get_list_of_integers_from_file(filename):
int_list=[]
for line in open(filename).readlines():
try:
int_list.append(int(line))
except:
continue
return int_list
print(get_list_of_integers_from_file('file.txt'))
File.txt:
Kindly check the output below.