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
Oliga [24]
2 years ago
13

Assume there are two variables, k and m, each already associated with a positive integer value and further assume that k's value

is smaller than m's. Write the code necessary to compute the number of perfect squares between k and m. (A perfect square is an integer like 9, 16, 25, 36 that is equal to the square of another integer (in this case 3*3, 4*4, 5*5, 6*6 respectively).) Associate the number you compute with the variable q. For example, if k and m had the values 10 and 40 respectively, you would assign 3 to q because between 10 and 40 there are these perfect squares: 16, 25, and 36,.
PYTHON CODING
Computers and Technology
1 answer:
ehidna [41]2 years ago
8 0

Answer:

import math  

def isPerfectSquare(n):

 s = int(math.sqrt(n))

 return n == s*s

def countPerfectSquares(k,m):

 q = 0

 for i in range(k,m):

   if isPerfectSquare(i):

     q=q+1

 return q

print(countPerfectSquares(10,40))

Explanation:

Note that this is including the k, but excluding m. If you want to include m, write m+1 in the range expression.

You might be interested in
Organizations should communicate with system users throughout the development of the security program, letting them know that ch
Fed [463]

Answer:

Yes it is true.The organization should indeed communicate with a system user throughout the development of a security program. A corporation needs a security policy that must be developed by management at all levels, including organization and employees at the operational level. For a corporate security plan, it is essential to reduce the resistance of the expected changes and define the objective.

Explanation:

Three objectives of the security plan in an organization are:

  • Identify the sensitive system and plan
  • Create and define the strategy and control of the system.
  • Develop and implement the training programs.

Security Information is one of the essential factors in the organization.For an organization, the information should be protected.

7 0
3 years ago
I had about 83 GB before I installed Xcode, I was in the middle of the installation and reconsidered my decision but it's still
Natasha_Volkova [10]

You can try downloading some kind of computer cleaner like CleanMyMac X free version, also definitely restart your computer if you haven't done so already.

4 0
2 years ago
Read 2 more answers
15)Which of the following statements is generally true about a V8 engine...
Vladimir79 [104]

Answer: Generally, there is an increase in power with a V8 engine.

Explanation:

A V8 engine has a bigger engine that cars with a V4 or V6 engines. They can go faster and gain speed at a faster rate than the other cars. They are not good on gas and use more gas than other cars with smaller engines.

Two things that are great about having a V8 engine is the torque and the power output. One of the most powerful engines with a V8 is a Dodge Challenger SRT. These engines are usually in bigger trucks and sports cars.

7 0
3 years ago
Write a method starString that accepts an integer parameter n and returns a string of stars (asterisks) 2n long (i.e., 2 to the
lys-0071 [83]

Answer:

public class Main

{

public static void main(String[] args) {

 System.out.println(starString(4));

}

public static String starString(int n){

    double p = Math.pow(2,n);

    String s = "";

    for(int i=0; i<p; i++)

        s += "*";

       

   return s;

}

}

Explanation:

Create a method named starString that takes an integer parameter, n

Get the 2 to the nth power using pow method and set it to the p

Create an empty string that will hold the asterisks

Create a for loop that will iterate p times. Inside the loop, concatenate an asterisk to the s

Return the s

Inside the main method, call the method with an integer parameter

4 0
3 years ago
Why is Thomas Jefferson considered an accomplished man , or a Renaissance man?​
lesantik [10]
The term “Renaissance man” means for a very clever person to be good at many different things.
4 0
3 years ago
Other questions:
  • What is a critique of the feature detector model of object recognition?​?
    8·1 answer
  • Your assignment is to write an assembly language program which read a string and print it in uppercase. This program asks the us
    15·1 answer
  • The birthday paradox says that the probability that two people in a room will have the same birthday is more than half, provided
    8·1 answer
  • Francis has applied for admission to a computer science program, and one of the requirements for admission is the completion of
    8·2 answers
  • You are the leader of a team at work. What type of leader would you like to be – one that gets involved and works with the team
    15·2 answers
  • All of the Internet in your country disappears. What happens next?
    13·1 answer
  • Write a C++ programthat returns the type of a triangle (scalene, equilateral,or
    12·1 answer
  • Write a C program (doublecopy) that allows a user to extract some part of an existing file (fileSource) and copy it twice to a n
    5·1 answer
  • What is the purpose of a hyperlink in a presentation?
    11·1 answer
  • Write a program to test if an integer input from the keyboard is odd or even. Sample Run 1: Enter a Number: 78 Even Sample Run 2
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!