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 is the importance of data validation, and how can user data entry errors be reduced or eliminated?
lisabon 2012 [21]

Incorrect data can lead to unexpected program execution results. Data entry errors can be reduced by only accepting valid input, e.g., if a number must be entered, alphabetic characters are ignored. After data validation, error messages can be prompted to the user, requiring him to enter the data again.

5 0
3 years ago
Each codec is stored within a file called a(n) ____ file.
frutty [35]
Im like 90% sure its a container file
5 0
3 years ago
Suppose you've decided to write a function template that you expect to use in many different source files. Suppose, further, tha
Sladkaya [172]

Answer:

The Solution to the given question can be defined as follows:

Explanation:

Please find the complete question in the attachment file.

In this case, the compiler will try to correct the model type by both the form we used when we try and call the method with both the appropriate form variable. It type of function. Consequently, unless the function in another file is specified, the compiler cannot locate the digital strategy. The point to note here is that only when this code is used, the template code shall be compiled.

The construct component will therefore be efficient so in this case, its connection stage would fail. An undefined connection to the feature <function name> can constitute a possible error in this case. It rules, therefore, address the construction project problem. Furthermore, the template function throughout the main program is generally recommended. It can be solved alternatively because parameters of a template like <function name><type> could be specified throughout the CPP file.

8 0
2 years ago
List the five body functions that monitor homeostasis.
IceJOKER [234]
You can also have homeostatis by shivering and sweating

6 0
3 years ago
List three functions that you can perform with a database that you cannot perform with a spreadsheet.
Delicious77 [7]
There are some function which can be performed with database but not with a spread sheet, these functions include: 
1. Enforcement of data type.
2. Support for self documentation.
3. Defining the relationship among constraints in order to ensure consistency of data.
5 0
3 years ago
Other questions:
  • If you don’t have a paper copy of the FAFSA form, how else can you fill it out?
    13·2 answers
  • What is another name for a blue screen error which occurs when processes running in kernel mode encouter a problem and windows m
    5·1 answer
  • What could prevent ping or traceroute responses from reaching the originating device beside network connectivity issues?
    14·1 answer
  • After the data are appropriately processed, transformed, and stored, what is a good starting point for data mining?
    15·1 answer
  • A(n) _____ is money paid for work.<br><br> A. raise <br> B. allowance<br> C. wage<br> D. grant
    14·2 answers
  • Sean Cody is a website most known for what?
    9·2 answers
  • Global address list characteristics
    11·1 answer
  • Under which command group will you find the options to configure Outlook rules?
    6·2 answers
  • Cyber security class i need help​
    11·1 answer
  • Print("Weight on Earth?")
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!