Chat with us, powered by LiveChat Part A (7 points) - writing text files You will need a Python repl to solve part A. Define a Python funct | WriteDen

Part A (7 points) – writing text files You will need a Python repl to solve part A. Define a Python funct

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!

HOW OUR WEBSITE WORKS

Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of 
HIGH QUALITY & PLAGIARISM FREE.

Step 1

To make an Order you only need to click ORDER NOW and we will direct you to our Order Page at WriteDen. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
 Deadline range from 6 hours to 30 days.

Step 2

Once done with writing your paper we will upload it to your account on our website and also forward a copy to your email.

Step 3
Upon receiving your paper, review it and if any changes are needed contact us immediately. We offer unlimited revisions at no extra cost.

Is it Safe to use our services?
We never resell papers on this site. Meaning after your purchase you will get an original copy of your assignment and you have all the rights to use the paper.

Discounts

Our price ranges from $8-$14 per page. If you are short of Budget, contact our Live Support for a Discount Code. All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.

Please note we do not have prewritten answers. We need some time to prepare a perfect essay for you.