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
AysviL [449]
3 years ago
15

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.
Computers and Technology
1 answer:
vivado [14]3 years ago
6 0

Answer:

def main():

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

   k=2;

   totalSum = 0

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

   while k <= n:

       totalSum = totalSum+is_prime(k)

       k=k+1

   print('Total sum of the prime numbers:',totalSum)

def is_prime(k):

   primeNumber = 0      

   i=1

   while i<=int(k):

       if (k % i) == 0:

           primeNumber = primeNumber + 1

       i=i+1

   if(primeNumber==2):      

       print(k)

       return k;

   else:        

       return 0;

main()

Explanation:

  • Run the while loop until k is less than n.
  • Determine if the variable k is prime then add it to the totalSum variable.
  • Increment the value of k by 1.
  • Create a function isPrime to check whether the number is prime  or not by determining the factors of k which can be found using the modulus operator.
  • Call the main function at the end.

You might be interested in
What does “modulate your voice” mean?
Pachacha [2.7K]
A) when u modulate some thing you vary it
5 0
3 years ago
A force of 50n acts on a body of mass 5kg. calculate acceleration produced .​
guapka [62]

Answer:

Force = 50n

mass = 5kg

Force = m * acc

50 = 5 * A

A = 50/5

A = 10 m/s^2

HOPE IT HELPS!!!

Explanation:

7 0
3 years ago
Compute the approximate acceleration of gravity for an object above the earth's surface, assigning accel_gravity with the result
Zepler [3.9K]

Answer:

The summary of the given query would be summarized throughout the below segment. The output of the question is attached below.

Explanation:

Given values are:

  • G = 6.673e-11
  • M = 5.98e24
  • accel \ gravity = 0
  • dist\ center=float(inp())

here,

inp = input

By utilizing the below formula, we get

⇒ \frac{GM}{d^2}

Now,

⇒ accel \ gravity=\frac{G\times M}{dist \ center**2}

⇒ print("Acceleration of gravity: {:.2f}".format(accel_gravity))

6 0
3 years ago
How many radio buttons from the following code can be selected at any given time?a.Home Addressb.Federal Expressc.UPS
ipn [44]

3 radio buttons from the following code can be selected at any given time.

<u>Explanation:</u>

In any programming language end user prompts either checkbox or radio buttons.

Normally checkbox are used for end user to select true or false methods where return value will true if checkbox click or false, one or zero. It all depends how end user uses the checkbox in his or her programming languages.

Radio buttons are used to end user in the programming languages where to select one radio buttons out of given radio buttons.

Where each radio buttons are marked with own assigned values. Based upon user selecting the radio buttons return will be assigned value of selected radio button.

If select option is multiple, each category of radio button is placed in grouping.

6 0
3 years ago
A normal lens has
nekit [7.7K]
It has a larger field of view
8 0
3 years ago
Other questions:
  • in the breezy python gui module, what class provides the basic functionality for any window, such as the command buttons in the
    10·1 answer
  • Thomas is using a drawing program to complete a construction. Which construction could he be completing? (5 points).
    5·2 answers
  • Which type of address defines a single network interface in a computer or other device?
    7·1 answer
  • In order for two computers to communicate via the internet, they must first locate one another. How do computers locate one anot
    12·1 answer
  • Which of the following is an open-source web browser?
    8·2 answers
  • Which clauses in the Software Engineering Code of Ethics are upheld by a whistleblower (check all that apply). "Respect confiden
    15·1 answer
  • You want to establish the validity of a test designed for computer technicians using a predictive criterion-related validation s
    9·1 answer
  • The effects of activating the complement system include all of the following except
    14·1 answer
  • Can nano gold be a way possibly reduce or kill cancer cell growth?
    13·1 answer
  • PART 2 - Exercise 2 - Programming Assignment
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!