Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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. 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started