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]
3 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]3 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
Which statement uses the example type of context clue for the underlined word?
Usimov [2.4K]
I think the answer is C
8 0
3 years ago
Read 2 more answers
State three advantages of using a printer​
Vera_Pavlovna [14]

Answer:

Advantage: Convenience. One of the key advantages of printing out material is that it is convenient.

Advantage: Secure Delivery. Paper records can be anonymously delivered

Advantage: Ease of Reading

I hope It helps

7 0
3 years ago
When you park facing downhill and there is a curb, turn your wheels _____ the curb. When you park facing uphill and there is a c
Nutka1998 [239]

Answer:

Well, according to my parents... the correct answer is C. toward,away from

I hope this is correct!

6 0
3 years ago
Read 2 more answers
The word Only is absolute or qualified
Semenov [28]

The word "only" is absolute.

5 0
3 years ago
Read 2 more answers
When you start a new blank document, you begin typing at the
Serhud [2]
C. The insertion poin
6 0
3 years ago
Other questions:
  • An essential skill today is knowing how to cite sources properly. Creative Commons has a system of licenses and tools for creato
    11·1 answer
  • Google Ads was designed to deliver three things to every advertiser: relevance, control, and results. It provides relevance by c
    11·1 answer
  • Type the correct answer in the box. In which phishing technique are URLs of the spoofed organization misspelled? _____ is a phis
    11·1 answer
  • A(n) _________ is a computer system which is part of a larger system which performs a dedicated function.
    8·1 answer
  • You want to establish the validity of a test designed for computer technicians using a predictive criterion-related validation s
    9·1 answer
  • When a collection of honeypots connects several honeypot systems on a subnet, it may be called a(n) honeynet
    9·1 answer
  • Which of the following file formats cannot be imported using Get & Transform?
    6·1 answer
  • Why was the Internet first developed? Use details and information to explain your answer.
    6·1 answer
  • Select three physical forms of storage. USB drive Primary cache Magnetic storage Secondary cache Dynamic RAM Optical drive
    7·2 answers
  • Phân tích 5 phương hướng nhiệm vụ phát triển nông -lâm -ngư nghiệp ở nước ta hiện nay
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!