Question: Write a function to return all the prime numbers less than n, where n is a parameter (assumen > 2). $ primes (40) [2,

Write a function to return all the prime numbers less than n, where n is a parameter (assumen > 2). $ primes Write a function to return all the prime factors of n, where n is a parameter (Hint: you can call your prime Write a function called increasing_digits to count all integers from 1 to n (inclusive) that have all digits Write a function called stats to return the mean, median, and standard deviation (in that order) of a list of Write a function called zero_triples to return all triples in a list of integers that sum to zero. You can

Write a function to return all the prime numbers less than n, where n is a parameter (assumen > 2). $ primes (40) [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37] ]: def primes (n): """Returns all prime numbers from 2 to n (excluding n) """ # YOUR CODE HERE raise Not ImplementedError() Write a function to return all the prime factors of n, where n is a parameter (Hint: you can call your prime function from the previous problem). $ factor (40) [2, 2, 2, 5] $ factor (23) [23] def factor (n): """""Return all the prime factors of n.""" #YOUR CODE HERE raise NotImplementedError() Write a function called increasing_digits to count all integers from 1 to n (inclusive) that have all digits in increasing order, where n is given as a parameter. For example, 5 is in increasing order (single digit) 237 is in increasing order (2 < 3 < 7) .227 is not (22) 427 is not (4 * 2) . [In]: increasing_digits (30) [Out]: 24 1: def increasing_digits(n): *** Returns the number of integers from 1 to $n$ (inclusive) that have all digits in increasing order, where $n$ is given as a parameter. www # YOUR CODE HERE raise NotImplementedError() Write a function called stats to return the mean, median, and standard deviation (in that order) of a list of integers, where the list of integers is given as a parameter. x Suppose the numbers are x,x2,...,x. Then the mean is = The median is the "middle" value is the number of integers (n) is odd, or the average of the two "middle" values if it is even (assuming the x, values are arranged in increasing order). The standard deviation is computed as follows: 11(x -). The stats must be returned in a list. Example: [In]: stats([15, 4, 10, 21) [Out]: [7.75, 7.0, 5.909032633745278] : import math ]: def stats(ints): www Returns the mean, median, and standard deviation (in that order) of a List of integers given as a parameter. www # YOUR CODE HERE raise Not ImplementedError() Write a function called zero_triples to return all triples in a list of integers that sum to zero. You can assume the list won't contain any duplicates, and a triple should not use the same number more than once. [In]: zero triples ( [1, 2, 4]) [Out]: [] [In]: zero_triples ( [-3, 1, 4, 21) [Out]: [[1, 2, -311 [In]: zero_triples ([-9, 1, -3, 2, 4, 5, -4, -1]) [Out]: [[-9, 4, 51, [1, -3, 2], [-3, 4, -1], [5, -4, -1]] def zero_triples (ints): Returns all triples in a list of integers that sum to zero. The list of integers is given as a parameter. Assumes the list will not contain any duplicates, and a triple should not use the same number more than once. www *** # YOUR CODE HERE raise NotImplementedError()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Note The given code does not have indentation So you can check in images of code that has indentation The images that are provided has code and output of the code Here is the Python code for each ques... View full answer

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 Programming Questions!