1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
pogonyaev
3 years ago
8

Python - Please help!

Computers and Technology
1 answer:
Margaret [11]3 years ago
6 0

Answer:

i= 1

for i in range(1,n):

     if i * i < n:

           print(2* i + 1)

     i += 1

else:

     print('Hakuna Matata')

Explanation:

First, there's a need to rewrite the code segment in your question (because of indentation)

<em>i= 1</em>

<em>while i*i < n:</em>

<em>      print(2* i + 1)</em>

<em>      i += 1</em>

<em>else:</em>

<em>      print('Hakuna Matata')</em>

<em />

The explanation of the equivalent of the above while loop is as follows

This line initializes i to 1

i= 1

This line iterates from 1 to n-1

for i in range(1,n):

This line checks if i * i is less than n

     if i * i < n:

The following line is executed if the above condition is satisfied; otherwise, nothing is done

           print(2* i + 1)

The value of i is incremented by 1 using this line

     i += 1

The following is executed at the end of the iteration

else:

     print('Hakuna Matata')

<em>Note: Assume any value of n, both programs display the same output</em>

You might be interested in
What formula would you enter in c4 that combines a4 and b4 to get a result like c2
Paul [167]

Available options

=A4&&B4

=A4&" "&B4

="A4"&""&"34"

=A4&""&B4

Answer:

=A4&""&B4

Explanation:

In a Microsoft Excel spreadsheet, to combine the content of two cells into another cell, a user will have to use the command &

Hence, in this case, given that there is no need to have any character or blank space in between the content of the starging cells, which is just A4 and B4, then we have the following technique

1. Select the cell C2

2. Input the command = or +, then select cell A4

3. Input the command &

4. Then select the cell B4

5. Click enter.

Therefore, the answer should appear as =A4&B4.

But from the available options, there is nothing like that, so we pick =A4&""&B4 because it gives the same outcome.

6 0
3 years ago
What is a network of high-capacity communication links is the internet?
mojhsa [17]

Social media is the high capacity of communication links

5 0
3 years ago
In microsoft word, when you highlight existing text you want to replace you are
RSB [31]
You are changing the word
8 0
3 years ago
Write pseudocode to solve the following problem: You are given an array A[1 . . . n] whose each element is a point of the plane
bixtya [17]

Answer:

Answer explained below

Explanation:

void bubbleSort(int X[], int Y[], int n)

{

   int i, j;

   for (i = 0; i < n-1; i++)      

     

   // Last i elements are already in place

   for (j = 0; j < n-i-1; j++)

       if (X[j] > X[j+1])

{

swap(X[j],X[j+1])

swap(Y[j],Y[j+1]);

}

       if (X[j] == X[j+1]&&Y[j]<Y[j+1])

{

swap(X[j],X[j+1])

swap(Y[j],Y[j+1]);

}

}

Since the above algorithm contains 2 nested loops over n.

So, it is O(n^2)

5 0
3 years ago
I just want a refund please. Thank you
Nina [5.8K]
Unfortunately you can’t be refunded points. Sorry :(
7 0
3 years ago
Other questions:
  • A banker would like to present a spreadsheet as part of a presentation to potential clients. The spreadsheet makes use of severa
    14·1 answer
  • Pros and cons of Processor Throttling or Scaling?
    13·1 answer
  • People in STEM careers are considered thinkers who reach conclusions through sound judgment and reasoning.
    11·1 answer
  • Why is television reactive, requiring no skills or thinking
    11·1 answer
  • Question 16 of 20
    12·2 answers
  • Question 21 pts How many lines should an email signature be? Group of answer choices "5 to 6" "7 to 8" "1 to 2" "3 to 4"
    10·1 answer
  • How can we style the images and layouts of our pages?
    8·1 answer
  • In the Dognition_aggregated_by_DogID data set, what is consistent about the relationship between breeding group and number of te
    15·1 answer
  • I can't find my grandson someone help
    14·2 answers
  • Which of the following cannot be used in MS Office.<br> Joystick<br> Scanner<br> Light Pen<br> Mouse
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!