Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

part A: question 1 : Extract specific values from the episode data Insert the code from the tutorial to use json.loads to convert the text

part A: question 1 :

Extract specific values from the episode data

Insert the code from the tutorial to use json.loads to convert the text string into a Python dictionary

  • Use json.loads to convert the text string into a Python dictionary
    • referencing the text portion of the response object get the name, airdate, runtime and summary values
    • assign the results to variable episode_data
  • Print each of the values using a separate print(...) statement on a separate line

# INSERT GET CODE USING JSON.LOADS TO GET THE NAME, AIRDATE, RUNTIME and SUMMARY

  • Get the first (only) list entry, the show dictionary entry and the id dictionary entry within the show dictionary values
    • NOTE: This can all be done with 1 line of code.
    • List entries are referenced using index values
    • Dictionary entries are referenced using key values
  • Save the show id in variable show_id
  • Print show_id ~ the value should be 44458
  • Question 2:

# INSERT CODE TO GET & PRINT THE 'TED LASSO' SHOW ID -- "id": 44458

#Get the first (only) list entry, the show dictionary entry and the id dictionary entry within the show dictionary values #show_id = json_data["id"][0]["show_id"] #json_data = json.loads (r.text)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions