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
Capstone Project part 11 quiz
kobusy [5.1K]
It is checking if the response is not yet yes
4 0
2 years ago
What should you do if your computer is running slower
Norma-Jean [14]

Answer:

Update system and files. Also delete unnecessary apps taking space

3 0
3 years ago
Help please fast
Pachacha [2.7K]
Bookmark because you can go back to it at any given time to re use it
4 0
3 years ago
Read 2 more answers
In which generation of computers are we in?​
qwelly [4]
It should be the Sixth generation
4 0
3 years ago
in your own ideas what are the disadvantages of participating in a videoconference write your answer inside the circle​
ipn [44]
Some disadvantages of taking part in a video-conference are:

1) Lack of communication from social cues (social cues are what we use to see if someone is in a good or bad mood)

2) There is a high chance of unstable network connection.

3) Technical and personal issues because not everyone is comfortable speaking on a video-conference platform.

4) It causes more stress due to the lack of organization when preparing meetings (because it’s so easy to just get on a device without preparing anything beforehand).

Hope this helped!
5 0
3 years ago
Other questions:
  • Find the word-length 2's complement representation of each of the following decimal numbers:a. 845b. 15000c. 100d. -923
    8·2 answers
  • What do you do to add a line or circle to your presentation?
    7·2 answers
  • Can your digital footprint be destroyed or does it remain active on the internet forever
    5·1 answer
  • An analog signal maintains a constant signal level for a period of time, then abruptly changes to a different constant level.
    5·2 answers
  • Please help with this coding question
    8·2 answers
  • Leon wants an output from his tablet. What should he look at?
    9·1 answer
  • 70 point Brainlist to best answer
    15·1 answer
  • a user complains he cannot access a particular website, although he is able to access other websites. At which layer of the OSI
    12·1 answer
  • What is the importance of test documentation?
    15·2 answers
  • What is the value of six sigma ? How dose it relate to agile management
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!