
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
i need help rewriting my code. the question and the errors are screenshotted. I spoke with a TA and they said that i dont need a loop and im supposed to use .urllib.request or whatever IN the function, not as a from statement like shown, Hence the rewrite part. Help would be immensely appreciated. i was told that this function should be pretty small.
from urllib.request import urlopen
import json
def json_loader(url):
response = urllib.request
json_data = json.loads(response.read())
for data, value in json_data.items():
print(data , ":" , value)

Transcribed Image Text:FAILED test_json_loader_empty:
I called json_loader("file:///home/autograde/autolab/empty.json")
expecting the result to be {},
but your function returned None.
ERROR when running test_json_loader_real_1:
ERROR when running test_json_loader_real_2:
ERROR when running test_json_loader_real_3:
ERROR when running test_json_loader_single:
PASSED test_load_data_header_only: |
json_loader is not defined or its definition does not match what the problem required
json_loader is not defined or its definition does not match what the problem required
json_loader is not defined or its definition does not match what the problem required
json_loader is not defined or its definition does not match what the problem required

Transcribed Image Text:json_loader
Define a function named json_loader with one parameter:
• the parameter is a string storing the URL we wish to load;
Your function must read the JSON blob stored at that URL. It should return that result of
converting that blob into usable Python data.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 2 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Write function files to compute each of the following without using built-in functions: Separate each digit of the given number. Decide whether a number is a prime. Decide the divisor (2-11,12,and 15) of a number. Convert the given number from decimal to binary, octal, or hexadecimal. Convert from binary, octal, or hexadecimal to decimal.arrow_forwardMake sure to show the full code with the screenshot of the output.arrow_forwardAdd a function to get the CPI values from the user and validate that they are greater than 0. 1. Declare and implement a void function called getCPIValues that takes two float reference parameters for the old_cpi and new_cpi. 2. Move the code that reads in the old_cpi and new_cpi into this function. 3. Add a do-while loop that validates the input, making sure that the old_cpi and new_cpi are valid values. + if there is an input error, print "Error: CPI values must be greater than 0." and try to get data again. 4. Replace the code that was moved with a call to this new function. - Add an array to accumulate the computed inflation rates 1. Declare a constant called MAX_RATES and set it to 20. 2. Declare an array of double values having size MAX_RATES that will be used to accumulate the computed inflation rates. 3. Add code to main that inserts the computed inflation rate into the next position in the array. 4. Be careful to make sure the program does not overflow the array. - Add a…arrow_forward
- I need help on my python assignment.arrow_forwardUnder the hood, all Python data types need to be represented as binary integers to be understood by the computer's hardware. You will write a program to peek under the hood at the decimal and binary representation of characters. You will need two new Python functions to perform the conversion that work similar to the built in type conversion functions. The ord() function is used to convert a letter to an integer. The bin() function converts an integer to a string representation of a binary number. To see how these functions work you should play with these functions in the shell, as we do in this example: >>> num = ord('A') >> print(num) 65 >> binary = bin(65) >> print(binary) Øb1000001 Write a program that asks the user for a letter and prints out both the integer and binary representations of the letter. It should ask the user for a character and then output the integer and binary representations of the character. Here is an example of what the output should look like if the user…arrow_forwardin the C++ version please suppose to have a score corresponding with probabilities at the end and do not use the count[] function. Please explain the detail when coding. DO NOT USE ARRAY. The game of Pig The game of Pig is a dice game with simple rules: Two players race to reach 100 points. Each turn, a player repeatedly rolls a die until either a 1 ("pig") is rolled or the player holds and scores the sum of the rolls (i.e. the turn total). At any time during a player's turn, the player is faced with two decisions: roll - if the player rolls 1: the player scores nothing and it becomes the opponents turn. 2 - 6: the number is added to the player's turn total and the player's turn continues. hold - The turn total is added to the player's score and it becomes the opponent's turn. This game is a game of probability. Players can use their knowledge of probabilities to make an educated game decision. Assignment specifications Hold-at-20 means that the player will choose to roll…arrow_forward
- You will need to build several (a minimum of 3) numerical arrays. You should use at least two different types float, double, integers, etc. You will need to build a function that randomly assigns values to those arrays. (Hint: Think overloaded functions. You'll probably want several of these functions for each of the rules you ) You will then need to build functions which finds the average of the array and one that finds the sum/total of the array. When finding the sum or average, you will need to make sure your code does not accidentally change the array value. This is for C++arrow_forwardPlease write the correct code for this question. I really don't know what can be changed.arrow_forwardSpecification You must write a script that prints a table of inches and their cquivalent centimcter values. You convert inches to centimeters using the formula cm = inches * 2.54 Centimeter values must be integers. At the top of the table should appear the labels "Inches" and "Centimeters", Under these labels should be a line of dashes. The centimeter values should align with the "Centimeters" label. In other words, it will work in exactly the same way as But it will do this in a different way. The script will create the table using 3 functions which you must write. • print_conversion_table • print_table_header • print_table_line These functions will be called using test code which you will find below. print_conversion_table This function must have the following header def print_conversion_table(min, max): This function will will print the conversion table. It will call print_table_header to print the labels at the top of the table. It will use a for loop to call print_line to print…arrow_forward
- Program: final.py Specification First, download the template file, final.py. This file contains the function names and documentation. You are required to add a header comment block with your name, the file name, the current semester, and year. Do not change the function headers, just add your implementation for each function where indicated. Add descriptive comments to your code. Remember to indent all the code for the function. Here are the functions that you will write: • Calculating tips is a common operation and the first function you write for the final project will do exactly that. The function calculate_tip accepts two parameters, the bill amount and the percent to tip, and returns the amount of the tip to write into the bill. The function should return the string "Invalid charge amount" if the charge is not more that 0 and "Invalid tip percent" if the tip is less than 0. Function heading: def calculate tip(charge, tip_percent): Parameter Specification: charge is the total ch…arrow_forwardI ran the code and still got the same error. The code still needs the value head. Please fix the code and show screenshots of the correct code with the output. Make sure to use various test cases to test the code to make sure it works. Attached are images of the directions.arrow_forwardI am learning import and exports in Javascript (NOT HTML), and I have imported my first file in to the second file. The issue I am running into is its saying my num variable is not a function. I need help understanding where I went wrong in my second file. I am asking bartleby for help because all of Google talks about is html files. This is the first file below: function centi_to_milli(centi) { return centi * 10; //multiply the length value by 10, Step A} function meter_to_centi(meter) { return meter * 100; //multiply the length value by 100, Step B} function kilo_to_meter(kilo) { return kilo * 1000; //multiply the length value by 1000, Step C} function inch_to_centi(inch) { return inch * 2.54; //multiply the length value by 2.54, Step D} function feet_to_centi(feet) { return feet * 30.48; //multiply the length value by 30.48, Step E} function yard_to_meter(yard) { return yard / 1.094; //divide the length value of 1.094, Step F} function mile_to_meter(mile) {…arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education