Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[4 marks] Create a dictionary nucleotides from the DNA sequence 'acgtaact' where the keys are the nucleotides (a, c, g, t) and the values

image

[4 marks] Create a dictionary nucleotides from the DNA sequence 'acgtaact' where the keys are the nucleotides (a, c, g, t) and the values are the frequency of each nucleotide. Print the dictionary as shown in the sample output below. Notice that the output is sorted by the frequency. Your code should work for any similar DNA sequence. dna = list("acgtaact") Output: Frequency of g is 1 Frequency of c is 2 Frequency of t is 2 Frequency of a is 3 [5 marks] For each of the scenarios below, explain what data structure (Python variable type) would be the best choice and why. a. Storing pairs of names and phone numbers. b. Storing a student's age. c. Storing a patient's details (height, weight, medications, etc.) that can't be changed. d. Storing the total cost of a shopping list. e. Storing whether a date is a public holiday or not. [2 marks] Given the following variable location, give the statement to print the h in ship. location = [34, [4.5, 12, [45, 6.7, 'ship']], 'wreck'] [4 marks] Write an input-validation loop to get the cost of an apple as a valid float, then print the cost for 10 apples. Your code should produce the output below (user input follows the "Cost of an Apple: " prompt): Cost of an Apple: five :) Invalid input Cost of an Apple: Invalid input Cost of an Apple: -1 Cost must be between 0 and 3 Cost of an Apple: 5 Cost must be between 0 and 3 Cost of an Apple: 1.5 Cost of 10 Apples is $15.00

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Chemical Principles

Authors: Steven S. Zumdahl, Donald J. DeCoste

7th edition

9781133109235, 1111580650, 978-1111580650

More Books

Students also viewed these Programming questions

Question

What is the name of the program?

Answered: 1 week ago

Question

How do cross-sectional and longitudinal studies differ?

Answered: 1 week ago