python:Write a function named "query_dict" that a key-value store as a parameter mapping strings to floating point numbers. The function will make an HTTPS GET request to the url "https://fury.cse.buffalo.edu/ps-api/a" with a query string containing the same key-value pairs from the input key-value store. The response from the server will be a JSON string representing an object in the format "{"answer": }" where is a floating point Number. Return the value at the key "answer" as a float Recall that you may need to convert the numbers to strings
Screenshot of code and output :-
Code in text format :-
# module for http get request
import requests
# api endpoint
URL = "https://fury.cse.buffalo.edu/ps-api/a"
reply = float
# defining a params dictionary
PARAMS = {'answer':reply}
# sending get request and saving the response as response
object
re = requests.get(url = URL, params = PARAMS)
# extracting data in json format
data = re.json()
# extracting answer from json string
reply = data['answer']
print(reply)
python:Write a function named "query_dict" that a key-value store as a parameter mapping strings to floating...
Write a function named "query_dict" that a key-value store as a parameter mapping strings to floating point numbers. The function will make an HTTPS GET request to the url "https://fury.cse.buffalo.edu/ps-api/a" with a query string containing the same key-value pairs from the input key-value store. The response from the server will be a JSON string representing an object in the format "{"answer": <Number>}" where <Number> is a floating point Number. Return the value at the key "answer" as a float Recall...
Write a function named "find_key" that takes a key-value store as a parameter with strings as keys and integers as values. The function returns a boolean representing true if the string "focus" is in the input as a key, false otherwise(javascript)
python: Write a function named "write_values" that takes a key-value store mapping strings to strings as a parameter and writes the values of the input to a file named "persuade.txt" with one element per line. If a file named "persuade.txt" already exists it must be overwritten. The function should not return any value
Write a function named "find_value" that takes a key-value store as a parameter with strings as keys and integers as values. The function returns a boolean representing true if the value 4 is in the input as a value, false otherwise
someone please help how do i make a request by using urllib.request? Write a function named "get_response" that three string parameters representing the protocol, name of a server, and a path for an HTTP GET request in this order. Return the response of an HTTPS GET request to the url formed by these inputs. Recall that a url will follow the format "<protocol>://<server_name>/<path>" The response should be returned as a string
In JavaScript define a function named 'lowInventory' which will be called with a dictionary mapping strings to numbers and which returns the number of key-value pairs whose value is lee than or equal to 10. Example: lowInventory({'milk':14,'butter':5,'bread':37,'jam':8}) must return 2 lowInventory{{'oil':16,'filter':29,'grease':42,'hydraulic fluid':18}) must return 0
Mapping Keys to Integer Values: Write a function mapKey() that can take a parameter of a. One String. For example: "Mary" or "lamb" or "a" or "" (null string) b. A list of Strings example: [ "Mary", "had", "a", "little", "lamb"] c. A Number d. A list of numbers And transforms the key to an integer numeric value by adding the numbers up in the list. You can use ord() to convert character to numberic or use a table lookup...
Define a JavaScript function named showScores which has one parameter which is a JSON blob (JSON encoding). The parameter encodes an object which maps strings to Numbers. This object will have the keys: "total" and "count". Your function should display the parameter's value associated with "total" in a div element whose id is "overall" . It must also display the parameter's value associated with "count" in a div element whose id is "num".
Define a JavaScript function named activityScore with one parameter. Assume the function will be called with an array of Numbers. Define the function so that it creates an Object. This object should have a key equal to "score", and its paired value should be set to the sum of the array’s entries. Return the JSON blob encoding the Object.
Python: Write a function named "sort_by_average_rating" that takes a list/array of key-value stores as a parameter where each key-value store has keys "ratings", "budget", and "box_office" where budget and box_office are integers and ratings is a list of integers. Sort the input based on the average of the values in "ratings"