Problem
For a random variable
As a motivating example, let
More generally, a random variable for which every one of a number of equally spaced outcomes has the same probability is called a uniform random variable (in the die example, this "equal spacing" is equal to 1). We can generalize our die example to find that if
Given: Six nonnegative integers, each of which does not exceed 20,000. The integers correspond to the number of couples in a population possessing each genotype pairing for a given factor. In order, the six given integers represent the number of couples having the following genotypes:
- AA-AA
- AA-Aa
- AA-aa
- Aa-Aa
- Aa-aa
- aa-aa
Return: The expected number of offspring displaying the dominant phenotype in the next generation, under the assumption that every couple has exactly two offspring.
Sample Dataset
Sample Output
Problem explanation
Source
couple = [18855, 19614, 16897, 18945, 16056, 16489]
ng = []
for i in range(len(couple)):
if i < 3:
ng.append(couple[i] * 2)
elif i == 3:
ng.append(couple[i] * 3 / 4 * 2)
elif i == 4:
ng.append(couple[i] / 2 * 2)
else :
ng.append(0)
print(sum(ng))
The Need for Averages
Averages arise everywhere. In sports, we want to project the average number of games that a team is expected to win; in gambling, we want to project the average losses incurred playing blackjack; in business, companies want to calculate their average expected sales for the next quarter.
Molecular biology is not immune from the need for averages. Researchers need to predict the expected number of antibiotic-resistant pathogenic bacteria in a future outbreak, estimate the predicted number of locations in the genome that will match a given motif, and study the distribution of alleles throughout an evolving population. In this problem, we will begin discussing the third issue; first, we need to have a better understanding of what it means to average a random process.
'Python > rosaland' 카테고리의 다른 글
Finding a Protein Motif (0) | 2018.12.13 |
---|---|
Finding a Shared Motif (0) | 2018.12.11 |
Overlap Graphs (0) | 2018.12.07 |
Mortal Fibonacci Rabbits (0) | 2018.12.05 |
Consensus and Profile (0) | 2018.12.05 |