The program is an illustration of loops.
Loops are used to perform repetitive and iterative operations.
The program in C++ where comments are used to explain each line is as follows:
#include <iostream>
using namespace std;
int main(){
//This declares and initializes all variables
string star = "*", blank = " ", temp;
//The following iteration is repeated 8 times
for (int i = 1; i <= 8; i++) {
//The following iteration is repeated 8 times
for (int j = 1; j <= 8; j++) {
//This prints stars
if (j % 2 != 0) {
cout << star;
}
//This prints blanks
else if (j % 2 == 0) {
cout << blank;
}
}
//This swaps the stars and the blanks
temp = star;
star = blank;
blank = temp;
//This prints a new line
cout << endl;
}
}
Read more about similar programs at:
brainly.com/question/16240864
In this question, we are given
,
-
A certain list, L, contains a total of n numbers, not necessarily distinct, that are arranged in increasing order.
- L1 is the list consisting of the first n1 numbers in L.
- L2 is the list consisting of the last n2 numbers in L.
Explanation:
As per the information given in statement 1, 17 is a mode for L1 and 17 is a mode for L2.
Therefore, we can infer that
,
- 17 must occur in L1, either same or a greater number of times as any other number in L1.
- 17 must occur in L1, either same or a greater number of times as any other number in L2.
As all elements in L are in ascending order, we can also conclude that
-
Each number between last occurrence of 17 in L1 and the first occurrence of 17 in L2 must be equal to 17 only.
- Therefore, 17 occurs either same or greater number of times as any other number in L.
- Thus, 17 is a mode for L.
However, from this statement, we cannot conclude anything about the mode of L1, L2, or L.
Hence, statement 2 is not sufficient to answer the question.
Therefore, 17 is a mode for L1 and 17 is a mode for L2.
Answer:
The function is as follows:
def divisible_by(listi, n):
mylist = []
for i in listi:
if i%n == 0:
mylist.append(i)
return mylist
pass
Explanation:
This defines the function
def divisible_by(listi, n):
This creates an empty list
mylist = []
This iterates through the list
for i in listi:
This checks if the elements of the list is divisible by n
if i%n == 0:
If yes, the number is appended to the list
mylist.append(i)
This returns the list
return mylist
pass
Answer:
We cant help with that. Maybe give me more information?