#HackTheVirus: Genome length
Your first task consists of defining a function called total_genomes_length() to compute the total length of a set of genomes of different viruses. The genome of each virus has a different length:
SARS coronavirus
29751 bp
Hepatitis C virus
9646 bp
Ebola virus
18959 bp
The input to your function will then be the number of individual viruses of each kind, that is, how many genomes for the SARS coronavirus, how many genomes for the Hepatitis C virus, and how many genomes for the Ebola virus. For example:
Input: total_genomes_length(1, 1, 1) → Output: 58356
Here the input translates to 1 SARS coronavirus genome, 1 Hepatitis C virus genome, and 1 Ebola virus genome. The output corresponds to the total length after adding the length of these individual genomes.
More examples:
- total_genomes_length(2, 10, 8) → 307634
- total_genomes_length(4, 3, 7) → 280655
- total_genomes_length(100, 200, 300) → 10592000
Ready? Implement your function below:
Got it? Check your code to get the password:
To check if your code solves correctly the problem, follow these steps in the interactive console:
1. Copy your code above for the definition of total_genomes_length(n_coronavirus, n_hepatitis, n_ebola) function in the console (you may need to do this line by line). Important: Copy the whole function definition: def total_genomes_length(n_coronavirus, n_hepatitis, n_ebola): …
Here there is an example on how to copy your code:
2. Call check.check(total_genomes_length) in the console and press ENTER.
3. If your code gives the correct answer, you will retrieve the password to get to the next exercise!