Def sum_divisors(n): sum =1 # Return the sum of all divisors of n, not including n x=int(n**0.5) for i in range(2,(x//1)+1): if n%i==0: sum=sum+i if n%i==0 and n/i!=i: sum=sum+(n/i) return sum print(sum_divisors(0)) # 0 print(sum_divisors(3)) # Should sum of 1 # 1 print(sum_divisors(36)) # Should sum of 1+2+3+4+6+9+12+18 # 55 print(sum_divisors(102)) # Should be sum of 2+3+6+17+34+51 # 114

Answers

Answer 1

Answer:

This is a python program that counts the number of divisors of a given number and calculates the sum of the divisors.

Explanation:

The first line defines a function "sum_divisors" with an argument "n". The square root of the argument is converted to integer and assigned to the variable "x", then a for loop is used to iterate through the range 2 to the calculated nth number of divisors in the argument.The return keyword returns the sum value.

The function is called with several arguments and printed with the print function.


Related Questions

These statements describe a network server.

assigns MACs
manages network resources
provides network security
translates data sent between networks

Answers

Answer:

The statement that describes a network server is:

manages network resources

Explanation:

A server is a computer built and programmed to fulfill network needs. They might be able to perform regular computer tasks, but they are designed specially to connect several computers, create a space those computers can share, provide connectivity management to them and be able to receive, send, create, and copy data inside that network. In other words, it creates a space of interaction, allows interaction, and transfer data from this network to other networks and from other networks for its managed network.

Have you ever seen a Magic 8 ball? You ask it a yes-no question and then shake it to get a random response like “Signs point to yes!”, “Very doubtful”, etc. If you’ve never seen a Magic 8 ball, check out this video.

We encourage you to work in pairs for this challenge. Come up with 8 responses to yes-no questions. Write a program below that chooses a random number from 1 to 8 and then uses if statements to test the number and print out the associated random response from 1-8. If you need help with random numbers, see lesson 2.9.

public class Magic8Ball
{
public static void main(String[] args)
{
// Get a random number from 1 to 8

// Use if statements to print out 1 of 8 responses


}
}
1
public class Magic8Ball
2
{
3
public static void main(String[] args)
4
{
5
// Get a random number from 1 to 8
6

7
// Use if statements to print out 1 of 8 responses
8

9

10
}
11
}

Answers

Answer:

ok ok ok

]ok

ok

okm

ok

Explanation:

The Principal of a school requires to store the information about the students of his school.
Which application software should he use to create a database? (Do it as homework)

Answers

Answer:

Microsoft office access would be a good application to create a database......it has various advantages such as storage and retrival of data, etc.

Explanation:

By Ms Excel the school principle write everything and to create students profile principle sir or headmaster use Microsoft so that students id cards will be created.

The different between a compiler and a translaror

Answers

Answer:

Compiler converts the program from one computer language to another computer language that is translating from a higher level language to a lower level language. A translator usually has a fixed body of code that is required to translate the program.

Answer:

Answer: Compiler converts the program from one computer language to another computer language that is translating from a higher level language to a lower level language. ... A translator usually has a fixed body of code that is required to translate the program.

Explanation:

Other Questions
Suppose the round-trip airfare between Philadelphia and Los Angeles a month before the departure date follows the normal probability distribution with a mean of $387.20 and a standard deviation of $68.50. What is the probability that a randomly selected airfare between these two cities will be between $325 and $425? what statement describes the structural characteristic of the poems? Biogeochemical cycles _______. A radio station is giving away tickets to a game. They are giving 2types of tickets: Front seats tickets cost 20 dollars and middle seatstickets cost 10 dollars. They want to give away atleast 20 tickets.But the total cost shouldn't be more than 280 dollarsWrite a system of two inequalities that describes this situation.Let x = number of $10 tickets and y = number of $20 tickets.[A]Graph the system to show all possible outcomes.[B]Write one possible solution to the problem in sentence form. A month of the year is chosen at random. What is the probability that the month starts with the letter J or the letter M?5/241/61/4 5/12 How do we create stronger evidence? A) better observations B) better opinions C) better theories D) better inference the total amount of fiber (in grams) in a package containing x apples and y oranges is given by the equation 5x + 10y = 110. is it possible for the package to contain 15 apples? EXPLAIN 25 POINTS IF YOU GET THIS ONE RIGHT! VERY HARD Solve the system of equations and choose the correct ordered pair.3x+2y= 126x + 3y = 21A. (3,2)B. (4.0)C. (4,3)D. 2, 3) Sebastian got estimates from 7 companies for his kitchen remodel: $ 27,500 ; $31,000 ; $36,000 ; $92, 000; $29,000 ; $30,500 ; $28,500. Which measure of center best describe the data, is it the mean or the median? 43 POINTS AND WILL MARK AS BRAINLIESTRead the following excerpt and pay close attention to the words the author uses:Those who came before us made certain that this country rode the first waves of the industrial revolution, the first waves of modern invention, and the first wave of nuclear power, and this generation does not intend to founder in the backwash of the coming age of space. We mean to be a part of it--we mean to lead it. For the eyes of the world now look into space, to the moon and to the planets beyond. We have vowed that we shall not see it governed by a hostile flag of conquest, but by a banner of freedom and peace. We have vowed that we shall not see space filled with weapons of mass destruction, but with instruments of knowledge and understanding.In a paragraph of four to six sentences, identify three words or phrases with positive connotations and explain how these words influence the paragraph. Be sure to specifically answer the following questions in your response: What images or ideas are associated with each word? How do these words influence the meaning and tone of this passage? Use proper spelling and grammar in your response. Which value has an absolute deviation of 5 from the mean of this data set?26, 12, 35, 28, 14A 28B. 35C. 26D. 14 Factor x^3 - 4x^2 + 7x - 28 by grouping. What is the resulting expression Simplify.Remove all perfect squares from inside the square root.\sqrt{175}= find the solutions to the equation (-3y)(6y)+9=0 Please help me with those questions please please help chose the sentence that best describes an antonym as a context clue to clarify the meaning of the italicized words All systems of the body are important and carry a different function for usto be healthy. Choose ONE from the 8 systems and briefly explain what you can do to help support its functioncan do to help support its function. What lead to the distancing of the enployee and the employer How many milliliters of 0.200 M NH4OH are needed to react with 12.0 mL of 0.550 M FeCl3?FeCl3 + 3NH4OH Fe(OH)3 + 3NH4Cl