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
xenn [34]
3 years ago
7

Assume the availability of a function is_prime. Assume a variable n has been associated with positive integer. Write the stateme

nts needed to find out how many prime numbers (starting with 2 and going in increasing order with successively higher primes [2,3,5,7,11,13,...]) can be added before exceeding n. Associate this number with the variable k. SUBMIT
Computers and Technology
1 answer:
My name is Ann [436]3 years ago
5 0

Answer:

def main():

   # Accept data from the user

   n=int(input('Enter the value of n:'))

   k=2;

   sum=0

   print('The list of the prime numbers are as follows:')

   # This loop runs from k to n

   while k<=n:

       # Call is_prime() method,

       # to check whether k is a prime or not

       sum=sum+is_prime(k)

       k=k+1

   print('Sum of the prime numbers:',sum)

# is_prime() Method

def is_prime(k):

   prime=0        

   i=1

   # Check k is a prime or not

   while i<=int(k):

       # Find the factors of k

       if (k % i) == 0:

           prime=prime+1

       i=i+1

   # If k as two factors

   if(prime==2):        

       print(k)

       return k;

   # If k as more than two factors

   else:        

       return 0;

# Call the main() method

main()

Explanation:

You might be interested in
would an electromagnet with a 3.7 volt lithium ion battery have an effect on devices and/or satelite signals like cell phones​
liraira [26]

Answer:

Some effect is there buts its almost negligible, and much less as compared to Ni-Cad batteries. Also this battery if recyclable, less toxic as well as remain in use for a very long time. Its used in satellites as well, and in one of them, it is now running without any fault for almost 13 years.

Explanation:

And you should check the list of noble price. Three great scientists John B. Goodenough, Akira Yoshino and Stanley Whittingham have got the noble prize for their work on Lithium Ion Batteries this year.

3 0
4 years ago
Which language do you use to add functionality to a web page
Dovator [93]
The answer is Javascript. In partner with HTML/HTML5 (Hypertext markup language : which provides the structure and CSS (Client Side Scripting : Provides the design to the structure). JS or Javascript programming language provides the function at the backend of a webpage. It responds to the input and also calls on the PHP / SQL Scripts to tap the database.
6 0
3 years ago
Fill in the blank with the correct response. Wanting to become a better archer is a what?
Oksi-84 [34.3K]
Is a better archer shooter
5 0
3 years ago
WILL MARK BRAINLIST. Which best describes a benefit of using the Meeting Window to create a meeting? A.Only the appointment deta
Ray Of Light [21]

I am not sure but my guess would be c.

5 0
3 years ago
To execute a prepared SQL statement, you can use the _______ and execute methods of the PDOStatement object to set parameter val
goldenfox [79]

Answer:

To execute a prepared SQL statement, you can use the bindValue

Explanation:

In PHP, the bindValue () function is inbuilt and can be used to bind values and variables to a parameter, hence it is more versatile. In SQL, the bindValue () function ties value to question mark placeholder or corresponding named in order to adequately get the statement ready.

7 0
3 years ago
Other questions:
  • How many generations of computer languages
    10·1 answer
  • simpley convert the code below to assembly languageYour proof-of-study task is to hand-compile the code below into an assembly l
    11·1 answer
  • Is a house phone a computer?<br> And why??
    14·2 answers
  • Partitioning the hard drive allows you to do which of the following?
    11·1 answer
  • Can you give me a long list of kid's cartoons
    15·1 answer
  • Today's Apple Mac computers run with the same I-Ternal hardware as the Windows based PC true or false
    5·1 answer
  • Lists and Procedures Pseudocode Practice For each situation, provide a pseudocoded algorithm that would accomplish the task. Mak
    8·1 answer
  • A consumer wants to add a hard drive to their computer to store video from their camera. Which of the following would represent
    9·1 answer
  • Blank Are input instructions you give to a computer
    13·1 answer
  • Identify the places in the code where there are object-oriented concept violations, content coupling, common coupling, control c
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!