Question

In: Computer Science

Fill in the blanks of this code to print out the numbers 1 through 7. number...

Fill in the blanks of this code to print out the numbers 1 through 7.

number = 1

while number ___ 7:

    print(number, end=" ")

    ___

Solutions

Expert Solution

number=1

while number <= 7:

print(number,end=" ")

number=number+1

Explanation:-

In above code underlined part is fill in the blank parts.

Here , we are using while loop to print number from 1 to 7 with spaces between them.

First blank is in condition part of while ,we used <= .This makes loop iterate 7 times.

In next blank , we are incrementing number by 1 .

if you want upto 6b then we can use < instead of <=.


Related Solutions

Java- Fill in the blanks Print numbers 0, 1, 2, ..., userNum as shown, with each...
Java- Fill in the blanks Print numbers 0, 1, 2, ..., userNum as shown, with each number indented by that number of spaces. For each printed line, print the leading spaces, then the number, and then a newline. Hint: Use i and j as loop variables (initialize i and j explicitly). Note: Avoid any other spaces like spaces after the printed number. Ex: userNum = 3 prints: 0 1 2 3 -------------------------------------------- public class NestedLoop { public static void main...
Fill in the blanks in the MATLAB code below.
Fill in the blanks in the MATLAB code below. (Do not type unnecessary words or blank spaces in your response. The correct answers are case-sensitive.) % Consider a row vector v. % Complete the lines of code below to find the average and standard deviation of the elements of vector v such that these two values are assigned to variables M and S, respectively. E = G =
Fill in the blanks with the following numbers, not the words, for this and all the...
Fill in the blanks with the following numbers, not the words, for this and all the questions that follow. Jot them down so you won't have to keep scrolling up to the top to see what they are: Demand = 1 Supply = 2 Right = 3 Left = 4 Up = 5 Down = 6 QUESTION 6 Suppose the dollar were to strengthen in international currency markets. That is, the price of the dollar, in terms of other national...
Fill in the blanks with the following numbers, not the words, for this and all the...
Fill in the blanks with the following numbers, not the words, for this and all the questions that follow. Jot them down so you won't have to keep scrolling up to the top to see what they are: Demand = 1 Supply = 2 Right = 3 Left = 4 Up = 5 Down = 6 QUESTION 4 Consider the case where an important technological innovation (e.g., the personal computer, iPhone, Internet, etc.) made labor more productive. This would cause...
Fill in the blanks in the problem with the 1 or 2 digit numbers from above:...
Fill in the blanks in the problem with the 1 or 2 digit numbers from above: A mass of ______ kg is attached to a spring, and stretches it by _____ cm. The mass is then pulled to a distance of ______ ?? below the spring’s equilibrium length, and given a downward velocity of ________ ?/? . Note: you may assume normal Earth gravity (g=9.8 m/s2 ) and that the spring is undamped. 1) What is the spring constant? 2)a)...
Fill-In-The-Blanks 13. Complete the code by filling in the blanks for each question below. (Length of...
Fill-In-The-Blanks 13. Complete the code by filling in the blanks for each question below. (Length of blank doesn’t matter.) a) Print out the contents of the array airlines. #include #include ________________ using namespace std; int main () { string airlines[] = {"american","pan-am","southwest"}; for (int i = 0;_______________;i++) cout << ____________ << endl; return 0; } b) Read in 5 integers from the user and write them back out in reverse order int numbers[5]; for(int i = 0; ___________; _________) cin...
The following code fragment is expressed in arm assembly code. Fill in the blanks, so that...
The following code fragment is expressed in arm assembly code. Fill in the blanks, so that it is equivalent to the following C code. int counter; int x = 5; int y = 6; for (counter =10; counter >0;counter--) IF(X==Y) Y = Y + 1 ; ELSE Y = Y + 2} Fill in the blanks in the following code: MOV__________ ;loop counter into r0-ten times round the loop MOV__________ ;Value of y loaded into r1 MOV__________ ;Value of x...
Fill in the blanks with suitable code and identify the type of inheritance in the following...
Fill in the blanks with suitable code and identify the type of inheritance in the following code snippet.(CO5) [Write all the three constructors completely in the answer sheet. Don’t write any other parts of the program] class Xyz { int one, two; public: Xyz(--------) {one=i; --------; } }; class Abc { int dc; public: Abc(int k) {-----------;} }; class Ijk: public Abc, public Xyz { int f; public: Ijk(int l, int m, int z, int n):-------,--------- { f=n;} }; int...
Fill in the blanks of the following segment of code, so that the output would be 1 3 4.
Fill in the blanks of the following segment of code, so that the output would be 1 3 4.int count = 0;do{++ count;if (count == 2)Blank;cout << count << " ";} while (count <= Blank);cout << endl;
Fill in the blanks in the following separate income statementsa through e.
Fill in the blanks in the following separate income statementsa through e. (Amounts to be deducted should be indicated by a minus sign.)abcdeSales$72,000$44,500$36,000$25,200Cost of goods soldMerchandise inventory (beginning)7,50016,9606,1007,0004,470Total cost of merchandise purchases58,00037,0006,800Merchandise inventory (ending)(2,100)(8,700)(6,000)Cost of goods sold33,39017,0007,800Gross profit5,90047,600Expenses22,00011,53010,0705,1006,600Net income (loss)$15,970$(4,170)$42,500
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT