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
How do you change between worksheets inside an excel workbook?
pochemuha
The correct answer is A
8 0
3 years ago
Read 2 more answers
Explain why the control bus is not a bus.
slava [35]
Cause a control bus is a computer bus and controlled by a computer while a bus is controlled by a driver
3 0
3 years ago
How to get amount after a percentage increase in excel​
Tresset [83]

Answer:

First: work out the difference (increase) between the two numbers you are comparing.

Increase = New Number - Original Number.

Then: divide the increase by the original number and multiply the answer by 100.

% increase = Increase ÷ Original Number × 100.

Explanation:

3 0
2 years ago
Read 2 more answers
Learning in a digital environment is also called learning.
aleksandrvk [35]

Learning in a digital environment is also called O<u>nline Learning.</u>

Explanation:

The main difference between the digital learning and the traditional form of learning is that

  • Digital Learning takes place online or virtually.
  • The traditional Learning is conducted in a classroom building.
  • Another factor that differentiate the 2 forms of learning is that the instructor or the trainer may not be present at the real-time but in a traditional training method the trainer or the instructor is present in person
6 0
4 years ago
Read 2 more answers
Which of the following is another name for cinematographers? (Select all that apply). lighting specialists production manager di
JulijaS [17]

Answer:

camera operators

directors of photography

Explanation:

Cinematography is simply the art of taking photos and being in charge of cameras in the process of film-making.

There are alternative names for a cinematographer and they include camera operators and directors of photography

3 0
3 years ago
Other questions:
  • Which of the following is NOT a view which can be chosen for a presentation?
    15·1 answer
  • Alice is adding a chart in a spreadsheet. Which option will allow you her to give the chart a suitable title and subtitle?
    11·2 answers
  • You are managing an FTP server installed in Ubuntu Server. The server has created a very large log le, vsftpd.log. Which command
    14·1 answer
  • A digital native is a person who has been exposed to technology at a(n) ___________ and is comfortable using it.a. old ageb. sch
    14·1 answer
  • Describing Report Viewing
    5·1 answer
  • Name 6 examples of how telemedicine is used in healthcare
    7·1 answer
  • You can put ______ on your phone.
    10·1 answer
  • Write a C++ program to grade the answers to a true-false quiz given to students in a course. The quiz consists of 5 true-false q
    7·1 answer
  • What is the chip that allows the screen to work
    14·2 answers
  • The cpu understands instructions written in a binary machine language. <br> a. true <br> b. false
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!