subject

Assume the availability of a function is_prime . assume a variable n has been associated with positive integer. write the statements 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,) can be added before exceeding n . associate this number with the variable k .
this is my code
def k(n):
sum = 0
k=2
while sum < = n:
if is_prime(k):
sum +=k
if sum < = n:
k+= 1

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 08:00
Aplan to budget time for studying and activities is referred to as a study routine. study habits. study skills. a study schedule.
Answers: 1
question
Computers and Technology, 22.06.2019 10:30
You are almost finished updating a web site. as part of the update, you have converted all pages from html 4.0 to html5. the project is currently on schedule. however, your project manager has been asked by the marketing team manager to justify a day of time spent validating the site's html5 pages. the marketing team manager does not have technical knowledge of the internet or the web. which is the most appropriate explanation to provide to the marketing team manager?
Answers: 1
question
Computers and Technology, 22.06.2019 22:20
Pp 4.1 design and implement a class called sphere that contains instance data that represents the sphere’s diameter. define the sphere constructor to accept and initialize the diameter and include getter and setter methods for the diameter. include methods that calculate and return the volume and surface area of the sphere (see pp 3.5 for the formulas). include a tostring method that returns a one-line description of the sphere. create a driver class called multisphere, whose main method instantiates and updates several sphere objects.
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
Who can provide you with a new password when you have forgotten your old one? your provide you with a new password in case you forget your old one.
Answers: 3
You know the right answer?
Assume the availability of a function is_prime . assume a variable n has been associated with positi...
Questions
question
Mathematics, 28.10.2020 03:10
question
Mathematics, 28.10.2020 03:10
question
Mathematics, 28.10.2020 03:10
Questions on the website: 13722360