Top Research Professionals
The research experts and assignment help team consists exclusively of highly qualified graduate writers, each professional with in-depth subject matter expertise and significant experience in custom academic writing.
For similar papers and sample answers; with a few clicks, Order your research paper, thesis, dissertation writing and other assignment help services
Posted: April 13th, 2023
Part A (7 points) – writing text files
You will need a Python repl to solve part A.
Define a Python function named write_authors with two parameters. The first parameter will be a list of dictionaries. Each dictionary in the list will include “author” among its keys. The second parameter will be a string specifying the name of the file to write to. Your function should open the file in a manner that ERASES the file’s contents. For each entry in the first parameter, write the value associated with its “author” key to the file and then a newline. Your function does not need to return anything.
Sample test cases:
write_authors([], “empty.txt”) ensures a file named empty.txt exists and is empty. (finds bug if file not opened properly)
write_authors([ {“author” : “Hertz”}, {“title” : “Hop on Pop”, “author” : “Seuss”} ], “simple.txt”) results in a file named simple.txt containing Hertz on its initial line and Suess on its other line. (finds bug if not looping through each entry in the list)
Part B (4 points) – writing CSV files
You will need a Python repl to solve part B.
Define a Python function named mult_years that two parameters. The first parameter will be a list. The second parameter will be a string specifying the name of a CSV file. Each entry in the first parameter is itself a list of 3 values representing the following fields:
Location Name, 2016 Malaria Cases, 2017 Malaria Cases
The location name will be a str and the latter two values will be ints. Your function will need to open the CSV file so that it can write to that file WITHOUT erasing any existing contents. For each entry in the first parameter, if it has non-zeros at both index 1 and index 2 (e.g., the location reported malaria cases in both years), write the entry to the CSV file. Since location name data may include commas, you should do this using Python’s built-in CSV library. You do not need to do anything when either (or both values) are equivalent to 0.
Sample test cases:
mult_years([], “unchanged.csv”) ensures a file named unchanged.csv exists, but that its contents are preserved (finds bug if file not opened properly)
mult_years([ [“Bronx”, 138, 51], [“Mongomery, MD”, 101, 99] ], “a.csv”) ends with the file named a.csv file having its next-to-last row with Bronx, 138, 51 and its last row containing “Mongomery, MD”, 101, 99 (finds bug if not using the CSV libraries for writing to the file)
Part C (4 points) – using DOM functions
You will need JavaScript repls to solve parts C1 and C2.
C1.
Create a JavaScript function named displayGrades that has 1 parameter. This parameter will be an object containing 2 keys. The first key is “score” and it’s value will be a Number. The second key is “letter” and its value is a String. Your function needs to set the contents of the div element with an id of “num” to the value associated with the key “score” and the contents of the div element with an id of “result” to the value associated with the key “letter”. Your function does not need to return anything.
Hint: variableName.toString() returns a human-readable representation of variableName’s value. This is often used when updating the contents of an HTML element to a Number.
Sample test cases require JavaScript code AND a webpage and so cannot be shown on this document. Sorry!
C2.
Create a JavaScript function named labExamScore that does not have any parameters. Your function should return the larger of the values stored in the text boxes (input widgets) whose ids are “original” and “makeup”.
Hint: The built-in function parseFloat(string_value) returns the Number represented by the string string_value.
Sample Test Cases require JavaScript code AND a webpage and so cannot be shown on this document. Sorry!
Study Notes, Research Topics & Assignment Examples: Discussion Healthy Eating Approach Essay »MKT00720 – Marketing Assignment 2: ReportWe prioritize delivering top quality work sought by college students.
The research experts and assignment help team consists exclusively of highly qualified graduate writers, each professional with in-depth subject matter expertise and significant experience in custom academic writing.
Our custom writing services maintain the highest quality while remaining affordable for students. Our pricing for research papers, theses, and dissertations is not only fair considering the superior quality but also competitive with other writing services.
We guarantee plagiarism-free, human-written content. Every product is assured to be original and not AI-generated. Our writers, tutors and editors are research experts who ensures the right formating and citation sytles are followed. To note, all the final drafts undergo rigorous plagiarism checks before delivery for submission to ensure authenticity for our valued customers.
When you decide to place an order with Dissertation Help, here is what happens: