Chat with us, powered by LiveChat Python module help. Need help correct my code. | Abc Paper

1. substrings(string, k): Input is a string and an integer k. Output is a list of all substrings of length k, of the input string.
my code:def substrings(string, k): return ”.join(random.choice(string) for x in range(k))print(substrings(“ACGT”,2))#how can i show all the possible combinations? #example input: (substrings(“ACGT”,2)# example output: AC, AG, AT, etc…2. profile(string_list, p=0): Input is string_list, a list of string. Output is a dictionary with keys are ‘A’, ‘B’, ‘C’ and ‘D’; and its values are lists of probability values for each position.””” The probability is calculated by dividing each count value at position i by the total of the counts for position i. This fraction represents the probability that that letter occurs at that position in the provided motifs. An optional parameter p results in probabilities that are calculated from a count matrix adjusted with pseudo-counts of p. “””3. select_new(motifs, probs). Input is a list of strings, and a list of associated probabilities. Output is one of the strings selected using the input probabilities. If the probability values do not add up to 1, they need to be normalized to be relative to their sum. This is analogous to simulating the throw of a loaded die.4. consensus(profile): Input is a list of strings. Output is a string corresponding to the most frequently occurring letter at each position.Consensus (list_of_string) :Most frequent letter in each position. E.g: strings of 4( ) ( ) ( ) ( )Input: AcctAgctAggtCgct
Most frequent at position 1: AMost frequent at position 2: GMost frequent at position 3: CMost frequent at position 4: T

error: Content is protected !!