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
What a true portrait reveal
Snowcat [4.5K]
Is simple likeness. Historically, in fact, artists used self-portraits as a kind of calling card, attesting to their ability to capture a likeness and giving a sense of their capabilities. And, yes, self-portraits are convenient exercises because the model is always available and works for free
5 0
3 years ago
The following function open_file() opens a file called 'example.txt' and returns the file pointer. This function is called withi
dsp73

Answer:

Code is given as below:

Explanation:

def open_file():

   fpointer = open('example.txt')

   return fpointer

def main():

   dictlist = []

   dict_of_words = dict()

   fp = open_file()

   # loop to iterate over lines in file

   for line in fp:

       for word in line.split():

           if(not dict_of_words.get(word)):

               dict_of_words[word] = 1

           else:

               dict_of_words[word] += 1

   for key, value in dict_of_words.items():

       temp = (key.lower(), value)

       dictlist.append(temp)

   print(sorted(dictlist))

main()

8 0
3 years ago
Who knows songs that are sad,happy,excited, and calm
anzhelika [568]

sad-

you broke me first

can we kiss forever

love the way you lie

happy-

Say Yes

Valerie

Walking on Sunshine

excited-

who let the dogs out

September

calm-

heather

put your records on

lonely

5 0
3 years ago
Which devices are likely to include a computer? Select 3 options.
Veronika [31]

Answer:

Cell Phone, ATM Cash Machine, and a GPS Mapping Device

5 0
3 years ago
The actual database of active directory shared resources is stored on one or more computers designated as:
Mila [183]

Solution:

It is done by Native Os X command line tool that can do this.

Active Directory, the data store contains database files and processes that store and manage directory information for users, services, and applications. A copy of the data store runs on each domain controller in the forest. The Active Directory data store is often referred to as the directory.

The ideal environment for the data store includes the following:

A domain controller running an operating system in the Windows Server 2003 family and containing hardware that meets the minimum hardware requirements of the edition of the operating system (Windows Server 2003, Standard Edition; Windows Server 2003, Enterprise Edition; or Windows Server 2003, Datacenter Edition)

For environments consisting of multiple domain controllers, the presence of a fully functioning Active Directory replication topology

For environments consisting of multiple domain controllers, the presence of a fully functioning File Replication Service (FRS) topology

A regular backup schedule

Regular monitoring of Active Directory, either through manual review of event logs or through an automated monitoring solution, such as Microsoft Operations Manager (MOM)

This is the required description describes the elements of the Active Directory data store, including its architecture, protocols, interfaces, logical structure, physical structure, processes and interactions, and network ports.


6 0
3 years ago
Other questions:
  • Which of the following is true of an enterprise search software? Select one:
    5·1 answer
  • NEED HELP PLEASEE!!!
    9·1 answer
  • Given that two int variables, total and amount, have been declared, write a sequence of statements that: initializes total to 0
    14·1 answer
  • Which remote access configuration option should you choose if you want mobile users to be able to make a secure connection to th
    9·2 answers
  • Where is most of the information processed in a computer
    13·1 answer
  • Chunking is a good strategy for completing large assignments because it makes the work
    7·2 answers
  • I have a variable and set it equal to 5. 1 then send it as an argument to a function that adds 5 to the variable passed in. Outs
    9·1 answer
  • Add and multiply
    10·1 answer
  • Read the scenario and then answer the question using only the information provided.
    14·2 answers
  • What is one of four key principles of Responsible Artificial Intelligence
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!