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]
2 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]2 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
Angela works for an identity protection company that maintains large amounts of sensitive customer information such as usernames
aksik [14]

Answer: (B) An insider

Explanation:

 According to the question, an Angela is an insider as she maintain all the sensitive and confidential information of the customer like the password, username,SSN (Social security number) and the personal information.

Angela and her co-worker has the right for using the customer sensitive information and data. An insider is the person who keeps all the sensitive information of the organization or company.

5 0
3 years ago
Is it possible to do calculations with text data in Ms Excel
ss7ja [257]
The answer for this question is YES
3 0
3 years ago
Read 2 more answers
Identify the following verb by number and person by checking on the appropriate boxes.
Makovka662 [10]
Second person ig Imao yeah
3 0
2 years ago
Read 2 more answers
Which of the following sets of data would be represented best in histogram?
wariber [46]
I think it would be B. The average monthly sales for the big toy company because its giving data over history
7 0
3 years ago
Read 2 more answers
An organization has a website with a guest book feature, where visitors to the web site can input their names and comments about
kozerog [31]

Answer:

B

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • Ann wants to download Adobe Acrobat software from the Internet. Prior to downloading, a standardized online contract appears on
    7·1 answer
  • Which of these is a preferred method for
    14·2 answers
  • Elena is used to kissing her friends on both cheeks as a form of greeting in her native country. She notices that her new friend
    6·1 answer
  • A hard drive that is running slowly may not have been
    10·2 answers
  • In the ______ stage of the systems development life cycle, the design specifications are translated into computer code.
    11·1 answer
  • What will be displayed if the following Java code segment is run? System.out.println("one "); System.out.print("two "); System.o
    12·1 answer
  • How do I modify objects in power point 2016 for an assignment
    11·1 answer
  • Kellyn needs to move Slide 8 of his presentation up so that it becomes Slide 6. What best describes how he can do this using the
    11·2 answers
  • Which statement best describes what happens when a computer starts?
    9·1 answer
  • Select the correct answer.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!