Answer:
The solution code is written in Python 3:
- def listBuilder(l1, length):
- result = []
-
- for x in l1:
- if(len(x) >= length):
- result.append(x)
-
- return result
Explanation:
Firstly, we create a variable result to hold the list will be returned at the end of the function. (Line 1)
Next, we create a for-loop to traverse the string in the l1 list (Line 4) and check for each string if their length is equal or bigger than the input length (Line 5). If so, we use append method to add the string to the result list.
At the end, return the result list as output (Line 8).
Answer:
Explanation:
The code below was coded in Java. It uses a loop to read 7 input integers and saves each one in an ArrayList called myList. Then it uses the Arrays built-in Java class to print out all the values in the arraylist. The code is tested and the output can be seen in the attached image below.
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
class Brainly {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
ArrayList<Integer> myList = new ArrayList<>();
for (int i = 0; i< 7; i++) {
int num = in.nextInt();
myList.add(num);
}
System.out.println(Arrays.toString(myList.toArray()));
}
}
Answer:
The data processing is broadly divided into 6 basic steps as Data collection, storage of data, Sorting of data, Processing of data, Data analysis, Data presentation, and conclusions. There are mainly three methods used to process that are Manual, Mechanical, and Electronic.
Answer:
The code solution is written in Python.
- positiveSum = 0
- negativeSum = 0
- num = int(input("Enter a number: "))
- while(num != 0):
- if(num > 0):
- positiveSum += num
- else:
- negativeSum += num
- num = int(input("Enter a number: "))
- print("Sum of positive number: " + str(positiveSum))
- print("Sum of negative number: " + str(negativeSum))
Explanation:
Firstly, we need to create two variables, <em>positiveSum</em> & <em>negativeSum</em>, to hold the running total of the positive and negative input numbers. (Line 1 - 2)
Next, use Python in-built method<em> input()</em> to prompt user for the first input number and assign it to variable <em>num</em>. (Line 4)
Create a <em>while-loop </em>by setting the condition as while input number is not equal to 0, the program shall positive to add the current input number to either variable<em> positiveSum</em> or <em>negativeSum</em>. (Line 6 -10) If the input number is bigger than zero, the current input number should be added to variable<em> positiveSum</em> else it should add to variable <em>negativeSum</em>.
Next, the program shall proceed to prompt user for the next input number. (Line 12)
The entire process is repeated until user enters zero to exit the while loop.
Lastly, display the total of positive and negative numbers. (Line 14 - 15)
<span>One of the main responsiblities is to provide a workplace free from serious recognized hazards and comply with standards of the </span><span>OSH Act.
That's all I know, hope this helps...
</span>