[4 marks] Create a dictionary nucleotides from the DNA sequence 'acgtaact' where the keys are the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
[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 [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
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
answer the question clearly You are building a flight-control system for which a convincing safety case must be made. Would you assign the tasks of safety requirements engineering, test case...
-
What is the difference between MouseListener and MouseAdapter? [3 marks] (b) Via suitable HTML, the compiled version of the following Java code is presented to the appletviewer application: import...
-
Heating oil futures contracts are traded on the New York Mercantile Exchange (NYM), a division of the CME Group. The standard contract size for heating oil futures is 43,600 gallons per contract. You...
-
Tascon Corporation sells coffee beans, which are sensitive to price fluctuations. The following inventory information is available for this product at December 31, 2011: Instructions (a) Calculate...
-
Match each histogram given with the following descriptions of data. 1. Number of cups of coffee consumed by one person during a day. 2. Maximum speed driven in a car by college students who drive. 3....
-
A viscous fluid flows in a \(0.10-\mathrm{m}\)-diameter pipe such that its velocity measured \(0.012 \mathrm{~m}\) away from the pipe wall is \(0.8 \mathrm{~m} / \mathrm{s}\). If the flow is laminar,...
-
Due to rapid employee turnover in the accounting department, the following transactions involving intangible assets were improperly recorded by Neitzke Corporation in 2012. 1. Neitzke developed a new...
-
Electromagnetic waves originate from the disturbance of electric and magnetic fields perpendicular to each other that can propagate in a vacuum. Explain three phenomena that occur in nature or in the...
-
You have the following data for your company: Book Value of Equity: $170 Book Value of Debt: $170 Market Value of Equity: $680 Required rate of return on equity: 12% Required rate of return on debt:...
-
Tamu Bhd is a Malaysia - based property developer specialising in large - scale mixed - use retail properties in prime city centre locations in Malaysia and Indonesia. The company develops and...
-
Waterways has two major public-park projects to provide with comprehensive Irrigation in one of its service locations this month. Job J57 and Job K52 involve 15 acres of landscaped terrain which will...
-
Solve the following algebraic equations for the numerical value of X: X = 3-27
-
1. Consider the following money-in-utility model. The utility function is given by u(c, m) B (In c + ln mt) t=0 and the budget constraint is given by: = at + kt +mt + bt = f(kt-1) + (18)kt-1 + mt-1...
-
Solve 3t2 - 30t + 6 = 96 by completing the square. NOTE: Enter your solutions exactly.
-
Write solutions neatly and show diagram or cash flow diagram so I can understand the solutuion On January 1, 2000, Luke bought a RAV4 worth P900,000 and intend to sell it for P300,000 after its 10...
-
What mass of KBr (in grams) should you use to make 350.0 mL of a 1.30 M KBr solution?
-
Observations of the reaction between nitrogen gas and hydrogen gas show us that 1 volume of nitrogen reacts with 3 volumes of hydrogen to make 2 volumes of gaseous product, as shown below: Determine...
-
Write electron configurations for each of the following. a. Cr, Cr2+, Cr3+ b. Cu, Cu+, Cu2+ c. V, Y2+, V3+
-
A general rule for a group of hydrocarbon isomers is that as the amount of branching increases, the boiling point decreases. Explain why this would be true.
-
A political pollster approaches people on the street and asks them to describe their political affiliation. Twenty-eight people describe themselves as Democrats, 25 as Republicans, 8 people provide a...
-
Listed below are a number of hypothetical research hypotheses. For each hypothesis, identify the independent and dependent variable. a. Male drivers are more likely to exhibit road rage behaviors...
-
Listed below are a number of research questions and hypotheses from actual published articles. For each hypothesis, identify the independent and dependent variable. a. The use of color in a Yellow...
Study smarter with the SolutionInn App