In: Computer Science
PYTHON
1. Write a program that takes the first derivative of f(x) = 3x2 + 20x + 5 and prints the values of this derivative at x= -5; x= +5 and x = +10
2. Write a program that takes the 2nd derivative of x5 and prints its value when x = 10.
3. Write a program that generates 5 random integers between 1 and 75 inclusive ad prints the 5 integers, one per line.
Thanks for the question. Below is the code you will be needing. Let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, please leave a +ve feedback : ) Let me know for any help with any other questions. Thank You! =========================================================================== # 1. Write a program that takes the first derivative of # f(x) = 3x2 + 20x + 5 and prints the values of this # derivative at x= -5; x= +5 and x = +10 x_values = (-5, 5, 10) for x in x_values: derivative = 6 * x + 20 print('Derivative of 3x2 + 20x + 5 at x={} is: {}'.format(x, derivative))
# 2. Write a program that takes the 2nd derivative of x5 and prints its value when x = 10. x = 10 derivative = 20 * x * x * x print('2nd derivative of x5 at x ={} is: {}'.format(x, derivative))
# 3. Write a program that generates 5 random integers # between 1 and 75 inclusive ad prints the 5 integers, one per line. import random for num in range(1, 6): random_number = random.randint(1, 75) print('Random #{}: {}'.format(num, random_number))