TutorMe homepage
Subjects
PRICING
COURSES
Start Free Trial
Aaron L.
Tutor with over 10 years experience and Senior eLearning Developer
Tutor Satisfaction Guarantee
Python Programming
TutorMe
Question:

Prompt the user to enter a number and then print all it's factors.

Aaron L.

Depending on whether you're using Python 2.7 or Python 3. There are slight differences '''Prints all numbers that are a factor of num''' def factors(num): for value in range(1,num + 1): #Iterate through numbers 1 to the number the user inputs if num % value == 0: #% returns the remainder when you divide the value into num print (value) #If a remainder of 0 is returned. It means value is a factor of #num #This is the main part of your code. factors(num) is a function that will only run when it's called in the main body of your python program if __name__ == "__main__": num = input("Please enter a number: ") #raw_input() for Python 2.7 instead of input() factors(int(num)) #This will run your factors() function defined above We need to put int() #around num to convert the string input into an int data type.

Calculus
TutorMe
Question:

Use the formal definition of a derivative to solve for the following equation: $(f(x) = x^2 + 2x -4$)

Aaron L.

The formal definition of a derivative is as follows: $(f'(x) = \lim_{h\to0} \frac{f(x + h)-f(x)}{h}$) To use that with our equation, we use substitution. The goal is to then expand and simplify so that we can sub in h = 0 since right now the denominator is equal to 0 if we try to substitute in right away: $(\lim_{h\to0} \frac{f(x + h)-f(x)}{h}$) $(= \lim_{h\to0}\frac{((x+h)^2 + 2(x+h) - 4 ) - (x^2 + 2x - 4)}{h}$) Expand the numerator and simplify: $(= \lim_{h\to0}\frac{x^2 + 2xh + h^2 + 2x+2h - 4 - x^2 - 2x + 4}{h}$) $(= \lim_{h\to0}\frac{2xh + h^2+2h}{h}$) Factor out h from all the numbers in the numerator: $(= \lim_{h\to0}\frac{h(2x + h+2)}{h}$) We can now cancel out the h that's in the numerator and denominator: $(= \lim_{h\to0}2x + h + 2$) Now we can sub in h = 0 and giving us the answer: $(2x + 2$) We can confirm this is correct with the derivative power rule. $(f(x) = x^n \Rightarrow f'(x) = nx^{n-1}$) Applying the power rule to our original equation: $(f(x) = x^2 + 2x - 4$) $(f'(x) = 2x + 2$)

Algebra
TutorMe
Question:

Solve the below equation: $(-20 + \frac{25}{x} = 4x$)

Aaron L.

Multiply both sides by x to get rid of the denominator: $(-20x + 25 = 4x^2$) Move all values to the left side of the equal sign and order by degree of x: $(4x^2-20x + 25 = 0$) Since this is a perfect square, you follow the rule: $(a^2 - 2ab + b^2 = (a+b)^2$) Apply the rule to the equation we're solving for $((2x-5)^2 = 0$) Square root both sides to get rid of the squared on the left. square of 0 is still 0. $(2x – 5 = 0$) Move 5 over to the right by add 5 to both sides of the equation $(2x = 5$) Divide both sides by 2 $(x = \frac{5}{2}$) Therefore, the equation has a repeated solution of $(x = \frac{5}{2}$)

Send a message explaining your
needs and Aaron will reply soon.
Contact Aaron