Question: P1. Implement two programs, in Racket and Python, to compute factorials. Submit a listing of your code, and the results. Remember: The factorial function, defined

 P1. Implement two programs, in Racket and Python, to compute factorials.

P1. Implement two programs, in Racket and Python, to compute factorials. Submit a listing of your code, and the results. Remember: The factorial function, defined recursively by u 1, if n=0 and n.(n-1, otherwise. For example, 7' = 7-6-5-4-3-2-1 se enumerate the number of ways that n distinct objects can be permuted. Racket code: (not safe code- should really check for valid input, have error messages, etc.) (define (factorial n) (if (= n 0) (* n (factorial (-n 1))) Python code: (again, not safe code) def mainl n = eval(input("Enter a non-negative integer: ")) printl"Factorial of", n, "is", factorial(n) # Return the factorial for the specified number def factorial(n) if n== 0: # Base case return 1 se: return n * factorial(n-1) # Recursive call mainl) # Call the main function P2. Write a program, using Python, to determine the mean, median, and standard deviation of a list of numbers. In addition, count the number of duplicate numbers in the code and list any numbers that occur more than once, with the number of times the number occurs. Submit a listing of your code, and the results. List=[3, 6, 7, 2, 8, 9, 2, 3, 7, 4, 5, 9, 2, 1,6,9,6]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!