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
I will mark you as brainlist
weeeeeb [17]

Answer:

download it

Explanation:

because if u upload it will not save .

7 0
2 years ago
Read 2 more answers
Marijuana and hashish come from the hemp plant?
raketka [301]
Yes they come from the hemp plant
5 0
3 years ago
Types of computer that we use in our daily life​
ozzi

Answer:

all coumputers

Explanation:

i just like coumputers

5 0
3 years ago
Read 2 more answers
What is the only language a microprocessor can process directly but most programmers almost never write programs in this code? Q
elixir [45]
A microprocessor can directly process machine code but most programmers almost never write in it.
C. Machine code
7 0
3 years ago
Read 2 more answers
Which term is used to describe a network security device or host software that filters communications, usually network traffic,
morpeh [17]

Answer:

The correct answer is option (D).

Explanation:

According to the scenario, the most appropriate answer is option (D) because the firewall can be defined as the software program which checks through the network for incoming and outgoing communication on predefined rules.

while the other options are wrong because of the following reasons :

  • A sniffer can be defined as the program which is used to check the network traffic but it didn't work on predefined rules.
  • An auditor can be defined as a program that is used to analyze the network.
  • The hacker can be a person who hacks the system to gain access or gather information.
4 0
3 years ago
Other questions:
  • Multiple users report that the network printer, which is connected through the print server, is not printing. Which of the follo
    12·1 answer
  • Carly is part of a community of developers. In her free time, she works on code to improve this open-source operating system. Th
    11·1 answer
  • One of the most common uses of spreadsheet are
    8·1 answer
  • What is the IEEE 802 standards name for a wireless network that is limited to one person's workspace?
    14·1 answer
  • ANSWER ASAP!!!!!
    10·2 answers
  • The challenge of preparing for ____________________ is in ensuring that employees do not feel that they are being prepared for t
    7·1 answer
  • What is the largest possible value that the variable x can have after the code segment executes? 17 17 A 14 14 B 11 11 C 4
    8·1 answer
  • Consider the following code segment.
    5·1 answer
  • How do you get off of the comments after you look at them wit out going all the way off the app?
    15·1 answer
  • How to do GCD on small basic?​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!